linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: check return value of kstrtoull correctly in reserved_clusters_store
@ 2017-06-15  9:57 Chao Yu
  2017-06-23  5:09 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Yu @ 2017-06-15  9:57 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, yuchao0, chao, Miao Xie

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.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Miao Xie <miaoxie@huawei.com>
---
 fs/ext4/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index d74dc5f81a04..48c7a7d55ed3 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -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);
-- 
2.13.1.388.g69e6b9b4f4a9

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: check return value of kstrtoull correctly in reserved_clusters_store
  2017-06-15  9:57 [PATCH] ext4: check return value of kstrtoull correctly in reserved_clusters_store Chao Yu
@ 2017-06-23  5:09 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2017-06-23  5:09 UTC (permalink / raw)
  To: Chao Yu; +Cc: adilger.kernel, linux-ext4, linux-kernel, chao, Miao Xie

On Thu, Jun 15, 2017 at 05:57:30PM +0800, Chao Yu wrote:
> 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.
> 
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> Signed-off-by: Miao Xie <miaoxie@huawei.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-23  5:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15  9:57 [PATCH] ext4: check return value of kstrtoull correctly in reserved_clusters_store Chao Yu
2017-06-23  5:09 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).