From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Claudiu Beznea <claudiu.beznea@microchip.com>
Cc: ludovic.desroches@microchip.com, linus.walleij@linaro.org,
nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com,
lars.povlsen@microchip.com, Steen.Hegelund@microchip.com,
daniel.machon@microchip.com, UNGLinuxDriver@microchip.com,
linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] pinctrl: microchip-sgpio: check return value of devm_kasprintf()
Date: Thu, 15 Jun 2023 14:04:09 +0300 [thread overview]
Message-ID: <ZIrwKaNwEuO/Wgxs@smile.fi.intel.com> (raw)
In-Reply-To: <20230615105333.585304-3-claudiu.beznea@microchip.com>
On Thu, Jun 15, 2023 at 01:53:32PM +0300, Claudiu Beznea wrote:
> devm_kasprintf() returns a pointer to dynamically allocated memory.
> Pointer could be NULL in case allocation fails. Check pointer validity.
> Identified with coccinelle (kmerr.cocci script).
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Fixes: 7e5ea974e61c ("pinctrl: pinctrl-microchip-sgpio: Add pinctrl driver for Microsemi Serial GPIO")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
> drivers/pinctrl/pinctrl-microchip-sgpio.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c
> index 4794602316e7..666d8b7cdbad 100644
> --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c
> +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c
> @@ -818,6 +818,9 @@ static int microchip_sgpio_register_bank(struct device *dev,
> pctl_desc->name = devm_kasprintf(dev, GFP_KERNEL, "%s-%sput",
> dev_name(dev),
> bank->is_input ? "in" : "out");
> + if (!pctl_desc->name)
> + return -ENOMEM;
> +
> pctl_desc->pctlops = &sgpio_pctl_ops;
> pctl_desc->pmxops = &sgpio_pmx_ops;
> pctl_desc->confops = &sgpio_confops;
> --
> 2.34.1
>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-06-15 11:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 10:53 [PATCH 0/3] pinctrl: check memory returned by devm_kasprintf() Claudiu Beznea
2023-06-15 10:53 ` [PATCH 1/3] pinctrl: mcp23s08: check return value of devm_kasprintf() Claudiu Beznea
2023-06-15 11:02 ` Andy Shevchenko
2023-06-15 10:53 ` [PATCH 2/3] pinctrl: microchip-sgpio: " Claudiu Beznea
2023-06-15 11:04 ` Andy Shevchenko [this message]
2023-06-15 10:53 ` [PATCH 3/3] pinctrl: at91-pio4: " Claudiu Beznea
2023-06-15 11:04 ` Andy Shevchenko
2023-06-15 11:05 ` [PATCH 0/3] pinctrl: check memory returned by devm_kasprintf() Andy Shevchenko
2023-06-16 13:02 ` Linus Walleij
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=ZIrwKaNwEuO/Wgxs@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@microchip.com \
--cc=daniel.machon@microchip.com \
--cc=lars.povlsen@microchip.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=nicolas.ferre@microchip.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®