]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ext4: check return value of kstrtoull correctly in reserved_clusters_store
authorChao Yu <yuchao0@huawei.com>
Fri, 23 Jun 2017 05:08:22 +0000 (01:08 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 23 Jun 2017 05:08:22 +0000 (01:08 -0400)
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: 76d33bca5581b1dd5c3157fa168db849a784ada4
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>
fs/ext4/sysfs.c

index d74dc5f81a0483b2bfeab1ab1216870ce8d25506..48c7a7d55ed305b16c3b9fa2bb054e4b97d122f5 100644 (file)
@@ -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);