lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c8d6fd87-c028-40e8-8158-99f636e74538@huawei.com>
Date: Tue, 26 Aug 2025 09:09:03 +0800
From: Jijie Shao <shaojijie@...wei.com>
To: Qianfeng Rong <rongqianfeng@...o.com>, Jian Shen <shenjian15@...wei.com>,
	Salil Mehta <salil.mehta@...wei.com>, Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: <shaojijie@...wei.com>
Subject: Re: [PATCH] net: hns3: use kcalloc() instead of kzalloc()


on 2025/8/25 22:27, Qianfeng Rong wrote:
> 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 #1
> Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
> ---

Thanks,
Reviewed-by: Jijie Shao <shaojijie@...wei.com>

>   drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
> index 0255c8acb744..4cce4f4ba6b0 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
> @@ -843,7 +843,7 @@ static int hns3_dbg_bd_file_init(struct hnae3_handle *handle, u32 cmd)
>   
>   	entry_dir = hns3_dbg_dentry[hns3_dbg_cmd[cmd].dentry].dentry;
>   	max_queue_num = hns3_get_max_available_channels(handle);
> -	data = devm_kzalloc(&handle->pdev->dev, max_queue_num * sizeof(*data),
> +	data = devm_kcalloc(&handle->pdev->dev, max_queue_num, sizeof(*data),
>   			    GFP_KERNEL);
>   	if (!data)
>   		return -ENOMEM;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ