From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFF88C32771 for ; Sat, 24 Sep 2022 21:41:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230245AbiIXVlh convert rfc822-to-8bit (ORCPT ); Sat, 24 Sep 2022 17:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbiIXVle (ORCPT ); Sat, 24 Sep 2022 17:41:34 -0400 Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B64F45982; Sat, 24 Sep 2022 14:41:31 -0700 (PDT) Received: from omf03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id AD6B21C5C3A; Sat, 24 Sep 2022 21:41:29 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA id A97AA6000A; Sat, 24 Sep 2022 21:41:27 +0000 (UTC) Message-ID: <4501be92173de178fe0a4207bbe9b5794dde2ef4.camel@perches.com> Subject: Re: [PATCH] virtio_fs.c: add check kmalloc return From: Joe Perches To: liujing , vgoyal@redhat.com Cc: stefanha@redhat.com, miklos@szeredi.hu, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sat, 24 Sep 2022 14:41:26 -0700 In-Reply-To: <20220924141728.3343-1-liujing@cmss.chinamobile.com> References: <20220924141728.3343-1-liujing@cmss.chinamobile.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Rspamd-Queue-Id: A97AA6000A X-Stat-Signature: i9x4t7rfwx3o3eh7rwdk4hhjbakyp31p X-Rspamd-Server: rspamout05 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+OMW+9Os61D9KqHecZ0xpvLQTaOdFP+zw= X-HE-Tag: 1664055687-37209 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2022-09-24 at 10:17 -0400, liujing wrote: > Signed-off-by: liujing 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.