Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net/mlx5e: Switch to kmemdup() when allocate dev_addr

Use kmemdup() helper instead of open-coding to
simplify the code when allocate dev_addr.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Saeed Mahameed <saeedm@nvidia.com>
Link: https://lore.kernel.org/r/20220914140100.3795545-2-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Yang Yingliang and committed by
Jakub Kicinski
13c76227 46ff47bc

+1 -2
+1 -2
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
··· 931 931 goto out; 932 932 } 933 933 934 - macsec_device->dev_addr = kzalloc(dev->addr_len, GFP_KERNEL); 934 + macsec_device->dev_addr = kmemdup(dev->dev_addr, dev->addr_len, GFP_KERNEL); 935 935 if (!macsec_device->dev_addr) { 936 936 kfree(macsec_device); 937 937 err = -ENOMEM; 938 938 goto out; 939 939 } 940 940 941 - memcpy(macsec_device->dev_addr, dev->dev_addr, dev->addr_len); 942 941 macsec_device->netdev = dev; 943 942 944 943 INIT_LIST_HEAD_RCU(&macsec_device->macsec_rx_sc_list_head);