Patch "pinctrl: stm32: Add check for devm_kcalloc" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    pinctrl: stm32: Add check for devm_kcalloc

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pinctrl-stm32-add-check-for-devm_kcalloc.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5c231d9d6795636f33b349b62b70a3e67976111c
Author: Chen Ni <nichen@xxxxxxxxxxx>
Date:   Tue Oct 31 08:08:07 2023 +0000

    pinctrl: stm32: Add check for devm_kcalloc
    
    [ Upstream commit b0eeba527e704d6023a6cd9103f929226e326b03 ]
    
    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@xxxxxxxxxxx>
    Acked-by: Valentin Caron <valentin.caron@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231031080807.3600656-1-nichen@xxxxxxxxxxx
    Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index a73385a431de9..419eca49ccecb 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)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux