[PATCH 0/4] pinctrl: use kcalloc() instead of kzalloc()

Qianfeng Rong rongqianfeng at vivo.com
Tue Aug 19 07:39:31 PDT 2025


Replace devm_kzalloc() with devm_kcalloc() in drivers/pinctrl.  As noted
in the kernel documentation [1], open-coded multiplication in allocator
arguments is discouraged because it can lead to integer overflow.

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

[1]: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments

Qianfeng Rong (4):
  pinctrl: microchip-sgpio: use kcalloc() instead of kzalloc()
  pinctrl: pinctrl-zynqmp: use kcalloc() instead of kzalloc()
  pinctrl: qcom: sc8180x: use kcalloc() instead of kzalloc()
  pinctrl: sunxi: use kcalloc() instead of kzalloc()

 drivers/pinctrl/pinctrl-microchip-sgpio.c | 2 +-
 drivers/pinctrl/pinctrl-zynqmp.c          | 2 +-
 drivers/pinctrl/qcom/pinctrl-sc8180x.c    | 2 +-
 drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c  | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.34.1




More information about the linux-arm-kernel mailing list