[PATCH v4 15/22] eventdev: fix listing timer adapters with telemetry

David Marchand david.marchand at redhat.com
Wed Jul 16 15:02:02 CEST 2025


If no timer adapter is created, listing with telemetry can lead to crash
and is reported by UBSan as an undefined behavior:

../lib/eventdev/rte_event_timer_adapter.c:1418:13:
	runtime error: applying zero offset to null pointer

../lib/eventdev/rte_event_timer_adapter.c:1464:13:
	runtime error: applying zero offset to null pointer

Fixes: 791dfec24d00 ("eventdev/timer: add telemetry")
Cc: stable at dpdk.org

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 lib/eventdev/rte_event_timer_adapter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
index 06ce478d90..af98b1d9f6 100644
--- a/lib/eventdev/rte_event_timer_adapter.c
+++ b/lib/eventdev/rte_event_timer_adapter.c
@@ -1410,7 +1410,7 @@ handle_ta_info(const char *cmd __rte_unused, const char *params,
 
 	adapter_id = atoi(params);
 
-	if (adapter_id >= RTE_EVENT_TIMER_ADAPTER_NUM_MAX) {
+	if (adapters == NULL || adapter_id >= RTE_EVENT_TIMER_ADAPTER_NUM_MAX) {
 		EVTIM_LOG_ERR("Invalid timer adapter id %u", adapter_id);
 		return -EINVAL;
 	}
@@ -1456,7 +1456,7 @@ handle_ta_stats(const char *cmd __rte_unused, const char *params,
 
 	adapter_id = atoi(params);
 
-	if (adapter_id >= RTE_EVENT_TIMER_ADAPTER_NUM_MAX) {
+	if (adapters == NULL || adapter_id >= RTE_EVENT_TIMER_ADAPTER_NUM_MAX) {
 		EVTIM_LOG_ERR("Invalid timer adapter id %u", adapter_id);
 		return -EINVAL;
 	}
-- 
2.50.0



More information about the dev mailing list