Commit f6e5ee6a authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Jakub Kicinski

net: thunderx: Use struct_size() helper in kmalloc()

Make use of the new struct_size() helper instead of the offsetof() idiom.
Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8df245c4
...@@ -2065,8 +2065,8 @@ static void nicvf_set_rx_mode(struct net_device *netdev) ...@@ -2065,8 +2065,8 @@ static void nicvf_set_rx_mode(struct net_device *netdev)
mode |= BGX_XCAST_MCAST_FILTER; mode |= BGX_XCAST_MCAST_FILTER;
/* here we need to copy mc addrs */ /* here we need to copy mc addrs */
if (netdev_mc_count(netdev)) { if (netdev_mc_count(netdev)) {
mc_list = kmalloc(offsetof(typeof(*mc_list), mc_list = kmalloc(struct_size(mc_list, mc,
mc[netdev_mc_count(netdev)]), netdev_mc_count(netdev)),
GFP_ATOMIC); GFP_ATOMIC);
if (unlikely(!mc_list)) if (unlikely(!mc_list))
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment