From: "J. Bruce Fields" <bfields@fieldses.org>
To: Rui Xiang <rui.xiang@huawei.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH RESEND] nfsd: return err directly while allocing failing
Date: Mon, 6 Jan 2014 16:31:08 -0500 [thread overview]
Message-ID: <20140106213108.GH31764@fieldses.org> (raw)
In-Reply-To: <52A52B08.9040305@huawei.com>
On Mon, Dec 09, 2013 at 10:29:28AM +0800, Rui Xiang wrote:
> while nthreads alloc fails, return err value directly
> without kfree.
This doesn't fix any problem that I can see, since kfree(NULL) is
defined to be a no-op.
--b.
>
> Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
> ---
> fs/nfsd/nfsctl.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index 7f55517..1fa6b00 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -491,9 +491,10 @@ static ssize_t write_pool_threads(struct file *file, char *buf, size_t size)
> }
>
> nthreads = kcalloc(npools, sizeof(int), GFP_KERNEL);
> - rv = -ENOMEM;
> - if (nthreads == NULL)
> - goto out_free;
> + if (nthreads == NULL) {
> + mutex_unlock(&nfsd_mutex);
> + return -ENOMEM;
> + }
>
> if (size > 0) {
> for (i = 0; i < npools; i++) {
> --
> 1.8.2.2
>
>
prev parent reply other threads:[~2014-01-06 21:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-09 2:29 [PATCH RESEND] nfsd: return err directly while allocing failing Rui Xiang
2014-01-06 21:31 ` J. Bruce Fields [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=20140106213108.GH31764@fieldses.org \
--to=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=rui.xiang@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.