On Tue, Nov 11, 2025 at 02:17:20PM -0800, Stephen Hemminger wrote:
> In theory, lcore and queue could be so large that mbuf pool name
> could overflow. But that can never happen since lcore and queue
> will be in range. Add a check so that static tools know that.
> 
> Signed-off-by: Stephen Hemminger <[email protected]>
> ---

Again, maybe include the warning omitted by the compiler

Acked-by: Bruce Richardson <[email protected]>


>  examples/ip_reassembly/main.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
> index 17ae76d4ba..25b904dbd4 100644
> --- a/examples/ip_reassembly/main.c
> +++ b/examples/ip_reassembly/main.c
> @@ -884,6 +884,13 @@ setup_queue_tbl(struct rx_queue *rxq, uint32_t lcore, 
> uint32_t queue)
>  
>       nb_mbuf = RTE_MAX(nb_mbuf, (uint32_t)NB_MBUF);
>  
> +     /* Should never happen but check so that pool name won't be too long. */
> +     if (lcore > RTE_MAX_LCORE || queue > RTE_MAX_QUEUES_PER_PORT) {
> +             RTE_LOG(ERR, IP_RSMBL, "invalid lcore %u or queue %u",
> +                     lcore, queue);
> +             return -1;
> +     }
> +
>       snprintf(buf, sizeof(buf), "mbuf_pool_%u_%u", lcore, queue);
>  
>       rxq->pool = rte_pktmbuf_pool_create(buf, nb_mbuf, MEMPOOL_CACHE_SIZE, 0,
> -- 
> 2.51.0
> 

Reply via email to