lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <03cf48b6-58b4-eeaa-41bf-5dda61ea37ac@omp.ru>
Date: Thu, 5 Sep 2024 17:50:28 +0300
From: Sergey Shtylyov <s.shtylyov@....ru>
To: Ma Ke <make24@...as.ac.cn>, <linus.walleij@...aro.org>,
	<mcoquelin.stm32@...il.com>, <alexandre.torgue@...s.st.com>,
	<bartosz.golaszewski@...aro.org>, <patrice.chotard@...s.st.com>,
	<antonio.borneo@...s.st.com>, <peng.fan@....com>,
	<valentin.caron@...s.st.com>, <akpm@...ux-foundation.org>
CC: <linux-gpio@...r.kernel.org>, <linux-stm32@...md-mailman.stormreply.com>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
	<stable@...r.kernel.org>
Subject: Re: [PATCH] pinctrl: stm32: check devm_kasprintf() returned value

On 9/5/24 5:02 AM, Ma Ke wrote:

> devm_kasprintf() can return a NULL pointer on failure but this returned
> value is not checked. Fix this lack and check the returned value.
> 
> Found by code review.
> 
> Cc: stable@...r.kernel.org
> Fixes: 32c170ff15b0 ("pinctrl: stm32: set default gpio line names using pin names")
> Signed-off-by: Ma Ke <make24@...as.ac.cn>
> ---
>  drivers/pinctrl/stm32/pinctrl-stm32.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index a8673739871d..53306d939d14 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -1374,8 +1374,13 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode
>  
>  	for (i = 0; i < npins; i++) {
>  		stm32_pin = stm32_pctrl_get_desc_pin_from_gpio(pctl, bank, i);
> -		if (stm32_pin && stm32_pin->pin.name)
> +		if (stm32_pin && stm32_pin->pin.name) {
>  			names[i] = devm_kasprintf(dev, GFP_KERNEL, "%s", stm32_pin->pin.name);
> +			if (!name[i]) {
> +				err = -ENOMEM;
> +				goto err_clk;
> +			}
> +		}
>  		else
>  			names[i] = NULL;

   That doesn't comply with the kernel coding style -- it now needs to be:

 		} else {
 			names[i] = NULL;
		}
[...]

MBR, Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ