mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "cgxu519@gmx.com" <cgxu519@gmx.com>
To: Zhouyang Jia <jiazhouyang09@gmail.com>
Cc: "cgxu519@gmx.com" <cgxu519@gmx.com>,
	Bob Peterson <rpeterso@redhat.com>,
	Andreas Gruenbacher <agruenba@redhat.com>,
	cluster-devel@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gfs2: add error handling for kmem_cache_zalloc
Date: Tue, 12 Jun 2018 15:24:41 +0800	[thread overview]
Message-ID: <C20C8754-0C63-4EB2-B3E9-68E4EE29338D@gmx.com> (raw)
In-Reply-To: <1528774692-38990-1-git-send-email-jiazhouyang09@gmail.com>


> 在 2018年6月12日,上午11:38,Zhouyang Jia <jiazhouyang09@gmail.com> 写道:
> 
> When kmem_cache_zalloc fails, the lack of error-handling code may
> cause unexpected results.
> 
> This patch adds error-handling code after calling kmem_cache_zalloc.

Should not fail on this case.

Thanks,
Chengguang.


> 
> Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
> ---
> fs/gfs2/trans.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
> index 064c9a0..da81eb4 100644
> --- a/fs/gfs2/trans.c
> +++ b/fs/gfs2/trans.c
> @@ -130,6 +130,9 @@ static struct gfs2_bufdata *gfs2_alloc_bufdata(struct gfs2_glock *gl,
> 	struct gfs2_bufdata *bd;
> 
> 	bd = kmem_cache_zalloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL);
> +	if (!bd)
> +		return NULL;
> +
> 	bd->bd_bh = bh;
> 	bd->bd_gl = gl;
> 	bd->bd_ops = lops;
> -- 
> 2.7.4
> 


  reply	other threads:[~2018-06-12  7:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12  3:38 Zhouyang Jia
2018-06-12  7:24 ` cgxu519 [this message]
2018-06-12  8:23   ` Andreas Gruenbacher
2018-06-12 12:18   ` [Cluster-devel] " Steven Whitehouse

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=C20C8754-0C63-4EB2-B3E9-68E4EE29338D@gmx.com \
    --to=cgxu519@gmx.com \
    --cc=agruenba@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=jiazhouyang09@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpeterso@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®