[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZIrwKaNwEuO/Wgxs@smile.fi.intel.com>
Date: Thu, 15 Jun 2023 14:04:09 +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 2/3] pinctrl: microchip-sgpio: check return value of
devm_kasprintf()
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@...ux.intel.com>
> Fixes: 7e5ea974e61c ("pinctrl: pinctrl-microchip-sgpio: Add pinctrl driver for Microsemi Serial GPIO")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@...rochip.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
Powered by blists - more mailing lists