]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
crypto: hisilicon - use kcalloc() instead of kzalloc()
authorQianfeng Rong <rongqianfeng@vivo.com>
Thu, 21 Aug 2025 14:27:31 +0000 (22:27 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 30 Aug 2025 07:43:26 +0000 (15:43 +0800)
commit41eab2a95950682cdc9c5e60cb3457e29f186540
treed29ba701b8500afe554504515b323ed2cfa27652
parent4c634b6b3c77bba237ee64bca172e73f9cee0cb2
crypto: hisilicon - use kcalloc() instead of kzalloc()

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.

Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Reviewed-by: Longfang Liu <liulongfang@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/hpre/hpre_main.c
drivers/crypto/hisilicon/sec2/sec_main.c
drivers/crypto/hisilicon/zip/zip_main.c