[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1560e9c0e5154802ab020b9da846d65f@sphcmbx02.sunplus.com.tw>
Date: Tue, 23 May 2023 17:39:51 +0000
From: Wells Lu 呂芳騰 <wells.lu@...plus.com>
To: "andy.shevchenko@...il.com" <andy.shevchenko@...il.com>,
Wells Lu <wellslutw@...il.com>
CC: "linus.walleij@...aro.org" <linus.walleij@...aro.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] pinctrl:sunplus: Add check for kmalloc
> > 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.
Do you mean I need to free all memory which are allocated in this subroutine before
return -ENOMEM?
> ...
>
> > 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
>
Best regards,
Wells Lu
Powered by blists - more mailing lists