Skip to content

Commit 518cb1e

Browse files
committed
bbdev: fix build with MinGW 13
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: 353e363 ("bbdev: add queue debug dump") Cc: [email protected] Signed-off-by: Thomas Monjalon <[email protected]> Acked-by: Bruce Richardson <[email protected]> Acked-by: Hemant Agrawal <[email protected]>
1 parent a462916 commit 518cb1e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/bbdev/rte_bbdev.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,11 +1264,15 @@ rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t queue_id, FILE *f)
12641264
dev->data->name, queue_id);
12651265
fprintf(f, " Last Enqueue Status %s\n",
12661266
rte_bbdev_enqueue_status_str(q_data->enqueue_status));
1267-
for (i = 0; i < RTE_BBDEV_ENQ_STATUS_SIZE_MAX; i++)
1267+
for (i = 0; i < RTE_BBDEV_ENQ_STATUS_SIZE_MAX; i++) {
1268+
const char *status_str = rte_bbdev_enqueue_status_str(i);
1269+
if (status_str == NULL)
1270+
continue;
12681271
if (q_data->queue_stats.enqueue_status_count[i] > 0)
12691272
fprintf(f, " Enqueue Status Counters %s %" PRIu64 "\n",
1270-
rte_bbdev_enqueue_status_str(i),
1273+
status_str,
12711274
q_data->queue_stats.enqueue_status_count[i]);
1275+
}
12721276
stats = &dev->data->queues[queue_id].queue_stats;
12731277

12741278
fprintf(f, " Enqueue Count %" PRIu64 " Warning %" PRIu64 " Error %" PRIu64 "\n",

0 commit comments

Comments
 (0)