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: <77e47143-2351-4f78-81b6-35ed4664f358@foss.st.com>
Date:   Tue, 31 Oct 2023 11:09:16 +0100
From:   Valentin CARON <valentin.caron@...s.st.com>
To:     Chen Ni <nichen@...as.ac.cn>, <linus.walleij@...aro.org>
CC:     <mcoquelin.stm32@...il.com>, <alexandre.torgue@...s.st.com>,
        <robh@...nel.org>, <geert+renesas@...der.be>, <bero@...libre.com>,
        <jernej.skrabec@...il.com>, <dario.binacchi@...rulasolutions.com>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-stm32@...md-mailman.stormreply.com>,
        <linux-gpio@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] pinctrl: stm32: Add check for devm_kcalloc

Hi Chen,

Thank you for your patch:

Acked-by: Valentin Caron <valentin.caron@...s.st.com>

Regards,
Valentin

On 10/31/23 09:08, Chen Ni wrote:
> Add check for the return value of devm_kcalloc() and return the error
> if it fails in order to avoid NULL pointer dereference.
>
> Fixes: 32c170ff15b0 ("pinctrl: stm32: set default gpio line names using pin names")
> Signed-off-by: Chen Ni <nichen@...as.ac.cn>
> ---
>   drivers/pinctrl/stm32/pinctrl-stm32.c | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index a73385a431de..419eca49ccec 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -1378,6 +1378,11 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode
>   	}
>   
>   	names = devm_kcalloc(dev, npins, sizeof(char *), GFP_KERNEL);
> +	if (!names) {
> +		err = -ENOMEM;
> +		goto err_clk;
> +	}
> +
>   	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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ