Thread (7 messages) flat view 7 messages, 4 authors, 2025-08-21
STALE360d LANDED

Landed in mainline as 2092b3b278be on 2025-08-21.

[PATCH 1/4] pinctrl: microchip-sgpio: use kcalloc() instead of kzalloc()

From: Qianfeng Rong <hidden>
Date: 2025-08-19 14:39:55
Also in: linux-gpio, lkml
Subsystem: arm/microchip sparx5 soc support, pin control subsystem, the rest · Maintainers: Steen Hegelund, Daniel Machon, Linus Walleij, Linus Torvalds

Use devm_kcalloc() in microchip_sgpio_register_bank() to gain built-in
overflow protection, making memory allocation safer when calculating
allocation size compared to explicit multiplication.

Signed-off-by: Qianfeng Rong <redacted>
---
 drivers/pinctrl/pinctrl-microchip-sgpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c
index 6191e5c13815..069cc665a402 100644
--- a/drivers/pinctrl/pinctrl-microchip-sgpio.c
+++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c
@@ -824,7 +824,7 @@ static int microchip_sgpio_register_bank(struct device *dev,
 	pctl_desc->confops = &sgpio_confops;
 	pctl_desc->owner = THIS_MODULE;
 
-	pins = devm_kzalloc(dev, sizeof(*pins)*ngpios, GFP_KERNEL);
+	pins = devm_kcalloc(dev, ngpios, sizeof(*pins), GFP_KERNEL);
 	if (!pins)
 		return -ENOMEM;
 
-- 
2.34.1

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help