ext4: check return value of kstrtoull correctly in reserved_clusters_store

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: 76d33bca55
Cc: stable@vger.kernel.org # 4.4
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>
This commit is contained in:
Chao Yu 2017-06-23 01:08:22 -04:00 committed by Theodore Ts'o
parent 4a4956249d
commit 1ea1516fbb

View file

@ -100,7 +100,7 @@ static ssize_t reserved_clusters_store(struct ext4_attr *a,
int ret; int ret;
ret = kstrtoull(skip_spaces(buf), 0, &val); ret = kstrtoull(skip_spaces(buf), 0, &val);
if (!ret || val >= clusters) if (ret || val >= clusters)
return -EINVAL; return -EINVAL;
atomic64_set(&sbi->s_resv_clusters, val); atomic64_set(&sbi->s_resv_clusters, val);