]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: hns3: use kcalloc() instead of kzalloc()
authorQianfeng Rong <rongqianfeng@vivo.com>
Mon, 25 Aug 2025 14:27:52 +0000 (22:27 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 27 Aug 2025 00:12:35 +0000 (17:12 -0700)
commit7e484a97f6d5f9cfc524294917555cf87e765d9b
treeba03033c63dc3d650c43d998ff3e5b94aa7f3317
parentb4d5cd20507b252c746fa6971d82ac96f3b3e5b7
net: hns3: use kcalloc() instead of kzalloc()

As noted in the kernel documentation, 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.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Reviewed-by: Jijie Shao <shaojijie@huawei.com>
Link: https://patch.msgid.link/20250825142753.534509-1-rongqianfeng@vivo.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c