Hi, > -----Original Message----- > From: dev <[email protected]> On Behalf Of Asaf Penso > Sent: Thursday, April 16, 2020 8:15 PM > To: [email protected] > Cc: Slava Ovsiienko <[email protected]>; Dekel Peled > <[email protected]>; [email protected] > Subject: [dpdk-dev] [PATCH] net/mlx5: fix location of assert function > > The asserts makes sure that 'i' doesn't exceed the exepcted 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: 21cae858 ("net/mlx5: allocate door-bells via DevX") > Cc: [email protected] > > Signed-off-by: Asaf Penso <[email protected]> > Reviewed-by: Dekel Peled <[email protected]> > Acked-by: Viacheslav Ovsiienko <[email protected]> > --- > drivers/net/mlx5/mlx5.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index f8b134c..df12a3b 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -1989,8 +1989,8 @@ struct mlx5_flow_id_pool * > i++) > ; /* Empty. */ > /* Find the first clear bit. */ > + MLX5_ASSERT(i < MLX5_DBR_BITMAP_SIZE); > j = rte_bsf64(~page->dbr_bitmap[i]); > - MLX5_ASSERT(i < (MLX5_DBR_PER_PAGE / 64)); > page->dbr_bitmap[i] |= (1 << j); > page->dbr_count++; > *dbr_page = page; > -- > 1.8.3.1
Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh

