Hi,
> -----Original Message-----
> From: dev <dev-boun...@dpdk.org> On Behalf Of Asaf Penso
> Sent: Thursday, April 16, 2020 8:15 PM
> To: dev@dpdk.org
> Cc: Slava Ovsiienko <viachesl...@mellanox.com>; Dekel Peled
> <dek...@mellanox.com>; sta...@dpdk.org
> 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: sta...@dpdk.org
> 
> Signed-off-by: Asaf Penso <as...@mellanox.com>
> Reviewed-by: Dekel Peled <dek...@mellanox.com>
> Acked-by: Viacheslav Ovsiienko <viachesl...@mellanox.com>
> ---
>  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

Reply via email to