mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
pinctrl: microchip-sgpio: use kcalloc() instead of kzalloc()
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 <rongqianfeng@vivo.com> Link: https://lore.kernel.org/20250819143935.372084-2-rongqianfeng@vivo.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
b8dc230254
commit
2092b3b278
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user