Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pinctrl: qcom: sc8180x: use kcalloc() instead of kzalloc()

Use devm_kcalloc() in sc8180x_pinctrl_add_tile_resources() 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>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/20250819143935.372084-4-rongqianfeng@vivo.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Qianfeng Rong and committed by
Linus Walleij
42311ea5 ae666486

+1 -1
+1 -1
drivers/pinctrl/qcom/pinctrl-sc8180x.c
··· 1634 1634 return 0; 1635 1635 1636 1636 /* Allocate for new resources */ 1637 - nres = devm_kzalloc(&pdev->dev, sizeof(*nres) * nres_num, GFP_KERNEL); 1637 + nres = devm_kcalloc(&pdev->dev, nres_num, sizeof(*nres), GFP_KERNEL); 1638 1638 if (!nres) 1639 1639 return -ENOMEM; 1640 1640