[PATCH 0/3] ASoC: Use kcalloc() instead of kzalloc()

Qianfeng Rong rongqianfeng at vivo.com
Wed Aug 20 22:34:17 AEST 2025


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

Using devm_kcalloc() provides built-in overflow protection, making the
memory allocation safer when calculating the 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 (3):
  ASoC: codecs: Use kcalloc() instead of kzalloc()
  ASoC: fsl: Use kcalloc() instead of kzalloc()
  ASoC: test-component: Use kcalloc() instead of kzalloc()

 sound/soc/codecs/fs-amp-lib.c      | 2 +-
 sound/soc/codecs/pcm6240.c         | 4 ++--
 sound/soc/fsl/fsl_sai.c            | 2 +-
 sound/soc/fsl/imx-audmux.c         | 2 +-
 sound/soc/generic/test-component.c | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.34.1



More information about the Linuxppc-dev mailing list