From: "Wells Lu 呂芳騰" <wells.lu@sunplus.com>
To: "andy.shevchenko@gmail.com" <andy.shevchenko@gmail.com>,
Wells Lu <wellslutw@gmail.com>
Cc: "linus.walleij@linaro.org" <linus.walleij@linaro.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] pinctrl:sunplus: Add check for kmalloc
Date: Tue, 23 May 2023 17:39:51 +0000 [thread overview]
Message-ID: <1560e9c0e5154802ab020b9da846d65f@sphcmbx02.sunplus.com.tw> (raw)
In-Reply-To: <ZGztCHNr1jmpFq0A@surfacebook>
> > 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
next prev parent reply other threads:[~2023-05-23 18:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 10:11 Wells Lu
2023-05-23 16:42 ` andy.shevchenko
2023-05-23 17:39 ` Wells Lu 呂芳騰 [this message]
2023-05-23 19:37 ` andy.shevchenko
2023-05-23 20:05 ` Christophe JAILLET
2023-05-25 3:22 ` Wells Lu 呂芳騰
2023-05-25 18:37 ` Christophe JAILLET
2023-05-25 19:42 ` Dan Carpenter
2023-05-26 2:04 ` Wells Lu 呂芳騰
2023-05-26 5:19 ` Christophe JAILLET
2023-05-25 19:19 ` Dan Carpenter
2023-05-25 20:00 ` Christophe JAILLET
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=1560e9c0e5154802ab020b9da846d65f@sphcmbx02.sunplus.com.tw \
--to=wells.lu@sunplus.com \
--cc=andy.shevchenko@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wellslutw@gmail.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®