Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0d3a7bd authored by Chao Yu's avatar Chao Yu Committed by Greg Kroah-Hartman
Browse files

ext4: check return value of kstrtoull correctly in reserved_clusters_store



commit 1ea1516fbbab2b30bf98c534ecaacba579a35208 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: 76d33bca
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarMiao Xie <miaoxie@huawei.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 71698654
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);