Skip to content

Commit

Permalink
ext4: check return value of kstrtoull correctly in reserved_clusters_…
Browse files Browse the repository at this point in the history
…store

commit 1ea1516 upstream.

kstrtoull returns 0 on success, however, in reserved_clusters_store we
will return -EINVAL if kstrtoull returns 0, it makes us fail to update
reserved_clusters value through sysfs.

Fixes: 76d33bc
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Miao Xie <miaoxie@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Chao Yu authored and Greg Kroah-Hartman committed Jul 15, 2017
1 parent f85a3c8 commit 20417e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ext4/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static ssize_t reserved_clusters_store(struct ext4_attr *a,
int ret;

ret = kstrtoull(skip_spaces(buf), 0, &val);
if (!ret || val >= clusters)
if (ret || val >= clusters)
return -EINVAL;

atomic64_set(&sbi->s_resv_clusters, val);
Expand Down

0 comments on commit 20417e9

Please sign in to comment.