diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2020-10-08 17:28:06 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-10-10 20:34:03 +0300 |
commit | f6e5ee6a2f3d13aa1786f3b52da7a5f663752df7 (patch) | |
tree | dfabdf8a95db668c2440533d971d1f86fb09fbe5 /drivers | |
parent | 8df245c40aa233f9f27908c71ed035165fa4f831 (diff) | |
download | linux-f6e5ee6a2f3d13aa1786f3b52da7a5f663752df7.tar.xz |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/nicvf_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index 0a94c396173b..f3b7b443f964 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -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; |