common/mlx5: fix MAC addresses flush

mlx5_nl_mac_addr_flush should flush all allocated MAC
addresses.

The MAC addresses array size should be of size
MLX5_MAX_MAC_ADDRESSES, but currently we return without
flushing the addresses if size is MLX5_MAX_MAC_ADDRESSES.

This was fixed by not allowing an array larger than
MLX5_MAX_MAC_ADDRESSES.

Fixes: e9a8ac59b6 ("common/mlx5: fix MAC addresses assert")
Cc: stable@dpdk.org

Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
This commit is contained in:
Shiri Kuzin 2020-07-29 17:29:00 +03:00 committed by Ferruh Yigit
parent 972a1bf812
commit 4a01fa047b

View file

@ -790,7 +790,7 @@ mlx5_nl_mac_addr_flush(int nlsk_fd, unsigned int iface_idx,
{
int i;
if (n <= 0 || n >= MLX5_MAX_MAC_ADDRESSES)
if (n <= 0 || n > MLX5_MAX_MAC_ADDRESSES)
return;
for (i = n - 1; i >= 0; --i) {