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 5E89BC77B75 for ; Tue, 23 May 2023 16:43:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237727AbjEWQnI (ORCPT ); Tue, 23 May 2023 12:43:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229775AbjEWQnF (ORCPT ); Tue, 23 May 2023 12:43:05 -0400 Received: from fgw20-7.mail.saunalahti.fi (fgw20-7.mail.saunalahti.fi [62.142.5.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17A9719B for ; Tue, 23 May 2023 09:42:51 -0700 (PDT) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id d9d7e6b2-f988-11ed-b3cf-005056bd6ce9; Tue, 23 May 2023 19:42:49 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Tue, 23 May 2023 19:42:48 +0300 To: Wells Lu Cc: linus.walleij@linaro.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, wells.lu@sunplus.com Subject: Re: [PATCH] pinctrl:sunplus: Add check for kmalloc Message-ID: References: <1684836688-9204-1-git-send-email-wellslutw@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1684836688-9204-1-git-send-email-wellslutw@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tue, May 23, 2023 at 06:11:28PM +0800, Wells Lu kirjoitti: > Fix Smatch static checker warning: > potential null dereference 'configs'. (kmalloc returns null) ... > configs = kmalloc(sizeof(*configs), GFP_KERNEL); > + if (!configs) > + return -ENOMEM; "Fixing" by adding a memory leak is not probably a good approach. ... > configs = kmalloc(sizeof(*configs), GFP_KERNEL); > + if (!configs) > + return -ENOMEM; Ditto. ... It might be that I'm mistaken. In this case please add an explanation why in the commit message. -- With Best Regards, Andy Shevchenko