net/mlx5: fix assert in doorbell lookup
authorAsaf Penso <asafp@mellanox.com>
Thu, 16 Apr 2020 17:15:09 +0000 (17:15 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 5 May 2020 13:54:26 +0000 (15:54 +0200)
commit9b080425e31297199dcbfa35d95d287d729c68a0
treec2bd1489d46b90bfb712565a5766c69383eb92a7
parentf21a98196a914912a0686b91b134672548badc4f
net/mlx5: fix assert in doorbell lookup

The asserts makes sure that 'i' doesn't exceed the expected value.
This to prevent an out of bound access to dbr_bitmap.

The current location of the assert protects the assignment of
dbr_bitmap, but not the access to it.

Moved the assert to the correct place, to protect both cases.
Also, used an existing define for the assert.

Fixes: 21cae8580fd0 ("net/mlx5: allocate door-bells via DevX")
Cc: stable@dpdk.org
Signed-off-by: Asaf Penso <asafp@mellanox.com>
Reviewed-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
drivers/net/mlx5/mlx5.c