From 2fec07edd4bca7ead134a5a1b4672a682d6c6ad4 Mon Sep 17 00:00:00 2001 From: Michael Baum Date: Thu, 1 Jul 2021 09:39:16 +0300 Subject: [PATCH] net/mlx5: fix overflow in mempool argument The mlx5_mprq_alloc_mp function makes shifting to the numeric constant 1, for sending it as a parameter to rte_mempool_create function. The rte_mempool_create function expects to get void pointer (uintptr_t, might be 64-bit) and instead gets a 32-bit variable, because the numeric constant size is a 32-bit. In case the shift is greater than 32 the variable might lose its value even though the function might get 64-bit argument. Change the size of the numeric constant 1 to uintptr_t. Fixes: 3a22f3877c9d ("net/mlx5: replace external mbuf shared memory") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_rxq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 23685d7654..dacffc9251 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1240,7 +1240,7 @@ mlx5_mprq_alloc_mp(struct rte_eth_dev *dev) snprintf(name, sizeof(name), "port-%u-mprq", dev->data->port_id); mp = rte_mempool_create(name, obj_num, obj_size, MLX5_MPRQ_MP_CACHE_SZ, 0, NULL, NULL, mlx5_mprq_buf_init, - (void *)(uintptr_t)(1 << strd_num_n), + (void *)((uintptr_t)1 << strd_num_n), dev->device->numa_node, 0); if (mp == NULL) { DRV_LOG(ERR, -- 2.20.1