net: thunderx: rework mac addresses list to u64 array
authorVadim Lomovtsev <Vadim.Lomovtsev@cavium.com>
Mon, 9 Apr 2018 13:24:48 +0000 (06:24 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 Apr 2018 14:59:38 +0000 (10:59 -0400)
commit9b5c4dfb2a6390bfb0166770d0d776ce0d3cdebd
tree683089621fed6136aa6e29c36d69041edcadfbd3
parentb6a37e5e25414df4b8e9140a5c6f5ee0ec6f3b90
net: thunderx: rework mac addresses list to u64 array

It is too expensive to pass u64 values via linked list, instead
allocate array for them by overall number of mac addresses from netdev.

This eventually removes multiple kmalloc() calls, aviod memory
fragmentation and allow to put single null check on kmalloc
return value in order to prevent a potential null pointer dereference.

Addresses-Coverity-ID: 1467429 ("Dereference null return value")
Fixes: 37c3347eb247 ("net: thunderx: add ndo_set_rx_mode callback implementation for VF")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/thunder/nic.h
drivers/net/ethernet/cavium/thunder/nicvf_main.c