On Wed, Aug 13, 2025 at 05:25:25PM +0200, Thomas Monjalon wrote:
> After an upgrade to MinGW version 13, compilation breaks:
> 
> In function 'rte_bbdev_queue_ops_dump':
> lib/bbdev/rte_bbdev.c:1269:63: error:
>       '%s' directive argument is null [-Werror=format-overflow=]
>       fprintf(f, "  Enqueue Status Counters %s %" PRIu64 "\n",
> 
> The enqueue status string may be null if the index is too high,
> because RTE_BBDEV_ENQ_STATUS_SIZE_MAX is defined to include
> padding for future enum insertion.
> This padding case must be checked
> to avoid printing a dump of a non-existing status.
> 
> Fixes: 353e3639d458 ("bbdev: add queue debug dump")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Thomas Monjalon <tho...@monjalon.net>
> ---
>  lib/bbdev/rte_bbdev.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
> index e0f8c8eb0d..d662a2b364 100644
> --- a/lib/bbdev/rte_bbdev.c
> +++ b/lib/bbdev/rte_bbdev.c
> @@ -1248,6 +1248,7 @@ rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t 
> queue_id, FILE *f)
>       struct rte_bbdev_queue_data *q_data;
>       struct rte_bbdev_stats *stats;
>       uint16_t i;
> +     const char *status_str;

Minor nit, but I'd suggest defining this inside the for loop at first use.

>       struct rte_bbdev *dev = get_dev(dev_id);
>  
>       VALID_DEV_OR_RET_ERR(dev, dev_id);
> @@ -1264,11 +1265,15 @@ rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t 
> queue_id, FILE *f)
>                       dev->data->name, queue_id);
>       fprintf(f, "  Last Enqueue Status %s\n",
>                       rte_bbdev_enqueue_status_str(q_data->enqueue_status));
> -     for (i = 0; i < RTE_BBDEV_ENQ_STATUS_SIZE_MAX; i++)
> +     for (i = 0; i < RTE_BBDEV_ENQ_STATUS_SIZE_MAX; i++) {
> +             status_str = rte_bbdev_enqueue_status_str(i);
> +             if (status_str == NULL)
> +                     continue;
>               if (q_data->queue_stats.enqueue_status_count[i] > 0)
>                       fprintf(f, "  Enqueue Status Counters %s %" PRIu64 "\n",
> -                                     rte_bbdev_enqueue_status_str(i),
> +                                     status_str,
>                                       
> q_data->queue_stats.enqueue_status_count[i]);
> +     }
>       stats = &dev->data->queues[queue_id].queue_stats;
>  
>       fprintf(f, "  Enqueue Count %" PRIu64 " Warning %" PRIu64 " Error %" 
> PRIu64 "\n",
> -- 
> 2.47.1
> 

Reply via email to