All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/bnxt: fix ctx_dma_arr allocation size
@ 2026-09-15  8:56 Evgeny Sokolov
  2026-09-15 14:34 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Evgeny Sokolov @ 2026-09-15  8:56 UTC (permalink / raw)
  To: Kishore Padmanabha, Ajit Khaparde, Damodharam Ammepalli
  Cc: dev, stable, Sokolov Evgeny

From: Sokolov Evgeny <Evgeny.Sokolov@infotecs.ru>

ctx_dma_arr stores rte_iova_t entries, but the allocation size was
calculated using sizeof(rte_iova_t *) instead of sizeof(rte_iova_t).

Use the correct element size when allocating the array to match the
actual data type stored in ctx_dma_arr.

Fixes: 4371b402c7b ("net/bnxt: fix array overflow")
Cc: stable@dpdk.org

Signed-off-by: Sokolov Evgeny <Evgeny.Sokolov@infotecs.ru>
---
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index a2429561b9..2754725566 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -5054,7 +5054,7 @@ static int bnxt_alloc_ctx_mem_blk(struct bnxt *bp,
 
 	snprintf(name, RTE_MEMZONE_NAMESIZE, "bnxt_ctx_dma_arr%s_%x_%d",
 		 suffix, idx, bp->eth_dev->data->port_id);
-	ctx_pg->ctx_dma_arr = rte_zmalloc(name, sizeof(rte_iova_t *) * rmem->nr_pages, 0);
+	ctx_pg->ctx_dma_arr = rte_zmalloc(name, sizeof(rte_iova_t) * rmem->nr_pages, 0);
 	if (ctx_pg->ctx_dma_arr == NULL)
 		return -ENOMEM;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/bnxt: fix ctx_dma_arr allocation size
  2026-09-15  8:56 [PATCH] net/bnxt: fix ctx_dma_arr allocation size Evgeny Sokolov
@ 2026-09-15 14:34 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2026-09-15 14:34 UTC (permalink / raw)
  To: Evgeny Sokolov
  Cc: Kishore Padmanabha, Ajit Khaparde, Damodharam Ammepalli, dev,
	stable

On Tue, 15 Sep 2026 08:56:06 +0000
Evgeny Sokolov <Evgeny.Sokolov@infotecs.ru> wrote:

> From: Sokolov Evgeny <Evgeny.Sokolov@infotecs.ru>
> 
> ctx_dma_arr stores rte_iova_t entries, but the allocation size was
> calculated using sizeof(rte_iova_t *) instead of sizeof(rte_iova_t).
> 
> Use the correct element size when allocating the array to match the
> actual data type stored in ctx_dma_arr.
> 
> Fixes: 4371b402c7b ("net/bnxt: fix array overflow")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Sokolov Evgeny <Evgeny.Sokolov@infotecs.ru>
> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index a2429561b9..2754725566 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -5054,7 +5054,7 @@ static int bnxt_alloc_ctx_mem_blk(struct bnxt *bp,
>  
>  	snprintf(name, RTE_MEMZONE_NAMESIZE, "bnxt_ctx_dma_arr%s_%x_%d",
>  		 suffix, idx, bp->eth_dev->data->port_id);
> -	ctx_pg->ctx_dma_arr = rte_zmalloc(name, sizeof(rte_iova_t *) * rmem->nr_pages, 0);
> +	ctx_pg->ctx_dma_arr = rte_zmalloc(name, sizeof(rte_iova_t) * rmem->nr_pages, 0);
>  	if (ctx_pg->ctx_dma_arr == NULL)
>  		return -ENOMEM;
>  

Maybe use rte_calloc() instead but fine as is.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-15 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-15  8:56 [PATCH] net/bnxt: fix ctx_dma_arr allocation size Evgeny Sokolov
2026-09-15 14:34 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.