Patch "pinctrl: sunplus: Add check for kcalloc" has been added to the 5.18-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: sunplus: Add check for kcalloc

to the 5.18-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-sunplus-add-check-for-kcalloc.patch
and it can be found in the queue-5.18 subdirectory.

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



commit 813593b032046338f6c1d1352c70a476ce55d793
Author: William Dean <williamsukatube@xxxxxxxxx>
Date:   Sun Jul 10 23:48:22 2022 +0800

    pinctrl: sunplus: Add check for kcalloc
    
    [ Upstream commit acf50233fc979b566e3b87d329191dcd01e2a72c ]
    
    As the potential failure of the kcalloc(),
    it should be better to check it in order to
    avoid the dereference of the NULL pointer.
    
    Fixes: aa74c44be19c8 ("pinctrl: Add driver for Sunplus SP7021")
    Reported-by: Hacash Robot <hacashRobot@xxxxxxxxxxx>
    Signed-off-by: William Dean <williamsukatube@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20220710154822.2610801-1-williamsukatube@xxxxxxx
    Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pinctrl/sunplus/sppctl.c b/drivers/pinctrl/sunplus/sppctl.c
index 3ba47040ac42..2b3335ab56c6 100644
--- a/drivers/pinctrl/sunplus/sppctl.c
+++ b/drivers/pinctrl/sunplus/sppctl.c
@@ -871,6 +871,9 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node
 	}
 
 	*map = kcalloc(*num_maps + nmG, sizeof(**map), GFP_KERNEL);
+	if (*map == NULL)
+		return -ENOMEM;
+
 	for (i = 0; i < (*num_maps); i++) {
 		dt_pin = be32_to_cpu(list[i]);
 		pin_num = FIELD_GET(GENMASK(31, 24), dt_pin);



[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