[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZIrwT6ib13SneacJ@smile.fi.intel.com>
Date: Thu, 15 Jun 2023 14:04:47 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Claudiu Beznea <claudiu.beznea@...rochip.com>
Cc: ludovic.desroches@...rochip.com, linus.walleij@...aro.org,
nicolas.ferre@...rochip.com, alexandre.belloni@...tlin.com,
lars.povlsen@...rochip.com, Steen.Hegelund@...rochip.com,
daniel.machon@...rochip.com, UNGLinuxDriver@...rochip.com,
linux-arm-kernel@...ts.infradead.org, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] pinctrl: at91-pio4: check return value of
devm_kasprintf()
On Thu, Jun 15, 2023 at 01:53:33PM +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@...ux.intel.com>
> Fixes: 776180848b57 ("pinctrl: introduce driver for Atmel PIO4 controller")
> Depends-on: 1c4e5c470a56 ("pinctrl: at91: use devm_kasprintf() to avoid potential leaks")
> Depends-on: 5a8f9cf269e8 ("pinctrl: at91-pio4: use proper format specifier for unsigned int")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@...rochip.com>
> ---
> drivers/pinctrl/pinctrl-at91-pio4.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> index e40487be2038..fc7d7155bb8d 100644
> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> @@ -1146,6 +1146,8 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
> /* Pin naming convention: P(bank_name)(bank_pin_number). */
> pin_desc[i].name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "P%c%u",
> bank + 'A', line);
> + if (!pin_desc[i].name)
> + return -ENOMEM;
>
> group->name = group_names[i] = pin_desc[i].name;
> group->pin = pin_desc[i].number;
> --
> 2.34.1
>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists