From: Boaz Harrosh <openosd@gmail.com>
To: Trond Myklebust <trond.myklebust@primarydata.com>,
linux-nfs@vger.kernel.org
Cc: Boaz Harrosh <bharrosh@panasas.com>
Subject: Re: [PATCH] pNFS: Handle allocation errors correctly in objlayout_alloc_layout_hdr()
Date: Sun, 01 Jun 2014 12:10:14 +0300 [thread overview]
Message-ID: <538AEDF6.8040301@gmail.com> (raw)
In-Reply-To: <1401409758-8035-1-git-send-email-trond.myklebust@primarydata.com>
On 05/30/2014 03:29 AM, Trond Myklebust wrote:
> Return the NULL pointer when the allocation fails.
>
> Cc: Boaz Harrosh <bharrosh@panasas.com>
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> ---
> fs/nfs/objlayout/objlayout.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c
> index 2f955f671003..765d3f54e986 100644
> --- a/fs/nfs/objlayout/objlayout.c
> +++ b/fs/nfs/objlayout/objlayout.c
> @@ -53,10 +53,10 @@ objlayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
> struct objlayout *objlay;
>
> objlay = kzalloc(sizeof(struct objlayout), gfp_flags);
> - if (objlay) {
> - spin_lock_init(&objlay->lock);
> - INIT_LIST_HEAD(&objlay->err_list);
> - }
> + if (!objlay)
> + return NULL;
> + spin_lock_init(&objlay->lock);
> + INIT_LIST_HEAD(&objlay->err_list);
> dprintk("%s: Return %p\n", __func__, objlay);
> return &objlay->pnfs_layout;
> }
>
Thanks! ACK
BTW it was not a bug. &NULL->pnfs_layout will return 0 because it is at offset 0.
Which explains why it works.
Thanks again, good catch
Boaz
prev parent reply other threads:[~2014-06-01 9:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-30 0:29 [PATCH] pNFS: Handle allocation errors correctly in objlayout_alloc_layout_hdr() Trond Myklebust
2014-06-01 9:10 ` Boaz Harrosh [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=538AEDF6.8040301@gmail.com \
--to=openosd@gmail.com \
--cc=bharrosh@panasas.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.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.