public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ext4: fix reserved_clusters_store()
Date: Fri, 23 Jun 2017 08:14:26 -0400	[thread overview]
Message-ID: <20170623121426.3e7sivaip6izvz5c@thunk.org> (raw)
In-Reply-To: <20170623092800.eize6ayzkvngpseq@mwanda>

On Fri, Jun 23, 2017 at 12:28:00PM +0300, Dan Carpenter wrote:
> The test if kstrtoull() failed is reversed so we can't set cluster_store
> any more.
> 
> Fixes: 76d33bca5581 ("ext4: refactor sysfs support code")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, this should already be fixed in the ext4.git tree.

	     	    	       	     	- Ted
			
commit f5b877c913026b9c5d4d1ac2916eff46c49b37a0
Author: Chao Yu <yuchao0@huawei.com>
Date:   Fri Jun 23 01:08:22 2017 -0400

    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: 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>

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);

      reply	other threads:[~2017-06-23 12:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23  9:28 [PATCH] ext4: fix reserved_clusters_store() Dan Carpenter
2017-06-23 12:14 ` Theodore Ts'o [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170623121426.3e7sivaip6izvz5c@thunk.org \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox