|SUCCESS| [2/2] ethdev: include device name in telemetry list output
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Wed May 20 14:43:53 CEST 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/164180
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-05-20
commit 50555-2 (patch 1/2)
Author: Chengwen Feng <fengchengwen at huawei.com>
dmadev: include device name in telemetry list output
The /dmadev/list telemetry endpoint currently returns only device IDs
as integers. Enhance it to return strings in "ID NAME" format so
users can identify devices by name directly from the telemetry output.
> diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
> index b75b4f9bd1..084e06a3da 100644
> --- a/lib/dmadev/rte_dmadev.c
> +++ b/lib/dmadev/rte_dmadev.c
> @@ -1147,12 +1147,19 @@ dmadev_handle_dev_list(const char *cmd __rte_unused,
> const char *params __rte_unused,
> struct rte_tel_data *d)
> {
> + char id_name[RTE_TEL_MAX_STRING_LEN];
> + struct rte_dma_dev *dev;
> int dev_id;
>
> - rte_tel_data_start_array(d, RTE_TEL_INT_VAL);
> - for (dev_id = 0; dev_id < dma_devices_max; dev_id++)
> - if (rte_dma_is_valid(dev_id))
> - rte_tel_data_add_array_int(d, dev_id);
> + rte_tel_data_start_array(d, RTE_TEL_STRING_VAL);
> + for (dev_id = 0; dev_id < dma_devices_max; dev_id++) {
> + if (!rte_dma_is_valid(dev_id))
> + continue;
> + dev = &rte_dma_devices[dev_id];
> + memset(id_name, 0, sizeof(id_name));
> + sprintf(id_name, "%d %s", dev_id, dev->data->dev_name);
Does this code check bounds before calling sprintf()? The device name
length is not validated before formatting into the fixed-size id_name
buffer. Can dev->data->dev_name overflow the RTE_TEL_MAX_STRING_LEN
buffer in sprintf()?
Also, consider using snprintf() for bounds-checked formatting as required
by the coding standards rather than sprintf().
[ ... ]
---
commit 50555-3 (patch 2/2)
Author: Chengwen Feng <fengchengwen at huawei.com>
ethdev: include device name in telemetry list output
The /ethdev/list telemetry endpoint currently returns only port IDs
as integers. Enhance it to return strings in "ID NAME" format so
users can identify ports by name directly from the telemetry output.
> diff --git a/lib/ethdev/rte_ethdev_telemetry.c b/lib/ethdev/rte_ethdev_telemetry.c
> index a910864bc5..f82b174110 100644
> --- a/lib/ethdev/rte_ethdev_telemetry.c
> +++ b/lib/ethdev/rte_ethdev_telemetry.c
> @@ -53,11 +53,17 @@ eth_dev_handle_port_list(const char *cmd __rte_unused,
> const char *params __rte_unused,
> struct rte_tel_data *d)
> {
> + char id_name[RTE_TEL_MAX_STRING_LEN];
> + struct rte_eth_dev *dev;
> int port_id;
>
> - rte_tel_data_start_array(d, RTE_TEL_INT_VAL);
> - RTE_ETH_FOREACH_DEV(port_id)
> - rte_tel_data_add_array_int(d, port_id);
> + rte_tel_data_start_array(d, RTE_TEL_STRING_VAL);
> + RTE_ETH_FOREACH_DEV(port_id) {
> + dev = &rte_eth_devices[port_id];
> + memset(id_name, 0, sizeof(id_name));
> + sprintf(id_name, "%d %s", port_id, dev->data->name);
Does this code check bounds before calling sprintf()? The device name
length is not validated before formatting into the fixed-size id_name
buffer. Can dev->data->name overflow the RTE_TEL_MAX_STRING_LEN buffer
in sprintf()?
Also, consider using snprintf() for bounds-checked formatting as required
by the coding standards rather than sprintf().
More information about the test-report
mailing list