mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-03 00:54:09 +08:00
net: thunderx: Use struct_size() helper in kmalloc()
Make use of the new struct_size() helper instead of the offsetof() idiom. Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
8df245c40a
commit
f6e5ee6a2f
@ -2065,8 +2065,8 @@ static void nicvf_set_rx_mode(struct net_device *netdev)
|
||||
mode |= BGX_XCAST_MCAST_FILTER;
|
||||
/* here we need to copy mc addrs */
|
||||
if (netdev_mc_count(netdev)) {
|
||||
mc_list = kmalloc(offsetof(typeof(*mc_list),
|
||||
mc[netdev_mc_count(netdev)]),
|
||||
mc_list = kmalloc(struct_size(mc_list, mc,
|
||||
netdev_mc_count(netdev)),
|
||||
GFP_ATOMIC);
|
||||
if (unlikely(!mc_list))
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user