net: thunderx: Use struct_size() helper in kmalloc()
Subsystems (3)
PATCH 1/1 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 <[email protected]>
--- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/cavium/thunder/nicvf_main.c +2 -2
@@ -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 ;
Signature · 1 line
2.27.0
Quoted 3 lines · On Thu, 8 Oct 2020 09:28:06 -0500 Gustavo A. R. Silva wrote:
Make use of the new
struct_size()helper instead of theoffsetof()idiom.Signed-off-by Gustavo A. R. Silva <[email protected]>
Applied, thanks!
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel