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
| ||
|
Message-Id: <20220909054244.73956-1-jiapeng.chong@linux.alibaba.com> Date: Fri, 9 Sep 2022 13:42:44 +0800 From: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com> To: borisp@...dia.com Cc: saeedm@...dia.com, leon@...nel.org, davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org, linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org, Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>, Abaci Robot <abaci@...ux.alibaba.com> Subject: [PATCH] net/mlx5: use kmemdup() to replace kzalloc + memcpy ./drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c:932:27-34: WARNING opportunity for kmemdup. Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2107 Reported-by: Abaci Robot <abaci@...ux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com> --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c index d9d18b039d8c..e32892943ee5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c @@ -929,14 +929,13 @@ static int mlx5e_macsec_add_secy(struct macsec_context *ctx) goto out; } - macsec_device->dev_addr = kzalloc(dev->addr_len, GFP_KERNEL); + macsec_device->dev_addr = kmemdup(dev->dev_addr, dev->addr_len, GFP_KERNEL); if (!macsec_device->dev_addr) { kfree(macsec_device); err = -ENOMEM; goto out; } - memcpy(macsec_device->dev_addr, dev->dev_addr, dev->addr_len); macsec_device->netdev = dev; INIT_LIST_HEAD_RCU(&macsec_device->macsec_rx_sc_list_head); -- 2.20.1.7.g153144c
Powered by blists - more mailing lists