projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4a7e925
)
pinctrl: stm32: Add check for devm_kcalloc
author
Chen Ni
<nichen@iscas.ac.cn>
Tue, 31 Oct 2023 08:08:07 +0000
(08:08 +0000)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Fri, 8 Dec 2023 07:52:21 +0000
(08:52 +0100)
[ 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@iscas.ac.cn>
Acked-by: Valentin Caron <valentin.caron@foss.st.com>
Link:
https://lore.kernel.org/r/20231031080807.3600656-1-nichen@iscas.ac.cn
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/stm32/pinctrl-stm32.c
patch
|
blob
|
history
diff --git
a/drivers/pinctrl/stm32/pinctrl-stm32.c
b/drivers/pinctrl/stm32/pinctrl-stm32.c
index
a73385a
..
419eca4
100644
(file)
--- 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)