mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: liujing <liujing@cmss.chinamobile.com>, vgoyal@redhat.com
Cc: stefanha@redhat.com, miklos@szeredi.hu,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] virtio_fs.c: add check kmalloc return
Date: Sat, 24 Sep 2022 14:41:26 -0700	[thread overview]
Message-ID: <4501be92173de178fe0a4207bbe9b5794dde2ef4.camel@perches.com> (raw)
In-Reply-To: <20220924141728.3343-1-liujing@cmss.chinamobile.com>

On Sat, 2022-09-24 at 10:17 -0400, liujing wrote:
> Signed-off-by: liujing <liujing@cmss.chinamobile.com>

Generally it's better to have a commit message

> diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
[]
> @@ -989,6 +989,10 @@ __releases(fiq->lock)
>  
>  	/* Allocate a buffer for the request */
>  	forget = kmalloc(sizeof(*forget), GFP_NOFS | __GFP_NOFAIL);
> +

A blank line is not typically used here.

> +	if (forget == NULL)
> +		return -ENOMEM;

And this is unnecessary as __GFP_NOFAIL will do what it says.

include/linux/gfp_types.h:

 * %__GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller
 * cannot handle allocation failures. The allocation could block
 * indefinitely but will never return with failure. Testing for
 * failure is pointless.


  reply	other threads:[~2022-09-24 21:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-24 14:17 liujing
2022-09-24 21:41 ` Joe Perches [this message]
2022-09-25 10:31 ` kernel test robot

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=4501be92173de178fe0a4207bbe9b5794dde2ef4.camel@perches.com \
    --to=joe@perches.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liujing@cmss.chinamobile.com \
    --cc=miklos@szeredi.hu \
    --cc=stefanha@redhat.com \
    --cc=vgoyal@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®