Skip to contentSkip to conversation

graph: fix xstats description allocation

PATCH Superseded Christophe Fontaine 3 participants 4 messages Oct 28, 2025 – Nov 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 graph: fix xstats description allocation

Fix the extended stats name allocation size: instead of allocating RTE_NODE_XSTAT_DESC_SIZE (64 bytes), only "sizeof(RTE_NODE_XSTAT_DESC_SIZE)" were allocated for each xstat name.

Fixes 070db97e01 ("graph: support node xstats")
---
 lib/graph/graph_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/graph/graph_stats.c +1 -1
index e0fc8fd25c..b87b5707f7 100644
@@ -302,7 +302,7 @@ stats_mem_populate(struct rte_graph_cluster_stats *stats,
 				    graph_node->node->name, graph->name);
 
 		cluster->stat.xstat_desc = rte_zmalloc_socket(NULL,
-			sizeof(RTE_NODE_XSTAT_DESC_SIZE) * graph_node->node->xstats->nb_xstats,
+			RTE_NODE_XSTAT_DESC_SIZE * graph_node->node->xstats->nb_xstats,
 			RTE_CACHE_LINE_SIZE, stats->socket_id);
 		if (cluster->stat.xstat_desc == NULL) {
 			rte_free(cluster->stat.xstat_count);
Signature · 1 line
2.51.0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines

Fix the extended stats name allocation size: instead of allocating RTE_NODE_XSTAT_DESC_SIZE (64 bytes), only "sizeof(RTE_NODE_XSTAT_DESC_SIZE)" were allocated for each xstat name.

Fixes 070db97e01 ("graph: support node xstats")
Quoted 19 lines

---
lib/graph/graph_stats.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
lib/graph/graph_stats.c +1 -2
index e0fc8fd25c..b87b5707f7 100644
@@ -302,7 +302,7 @@ stats_mem_populate(struct rte_graph_cluster_stats *stats,
                                   graph_node->node->name, graph->name);
 
               cluster->stat.xstat_desc = rte_zmalloc_socket(NULL,
-                       sizeof(RTE_NODE_XSTAT_DESC_SIZE) * graph_node->node->xstats->nb_xstats,
+                       RTE_NODE_XSTAT_DESC_SIZE * graph_node->node->xstats->nb_xstats,
                       RTE_CACHE_LINE_SIZE, stats->socket_id);
               if (cluster->stat.xstat_desc == NULL) {
                       rte_free(cluster->stat.xstat_count);
--

2.51.0

#2 lore raw

PATCH v2 1/1 graph: fix xstats description allocation

In reply to Christophe Fontaine

Fix the extended stats name allocation size: instead of allocating RTE_NODE_XSTAT_DESC_SIZE (64 bytes), only sizeof(RTE_NODE_XSTAT_DESC_SIZE) were allocated for each xstat name.

Fixes 070db97e017b ("graph: support node xstats")

---

Notes:
v2: add acked-by
fix sha length

 lib/graph/graph_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/graph/graph_stats.c +1 -1
index e0fc8fd25c..b87b5707f7 100644
@@ -302,7 +302,7 @@ stats_mem_populate(struct rte_graph_cluster_stats *stats,
 				    graph_node->node->name, graph->name);
 
 		cluster->stat.xstat_desc = rte_zmalloc_socket(NULL,
-			sizeof(RTE_NODE_XSTAT_DESC_SIZE) * graph_node->node->xstats->nb_xstats,
+			RTE_NODE_XSTAT_DESC_SIZE * graph_node->node->xstats->nb_xstats,
 			RTE_CACHE_LINE_SIZE, stats->socket_id);
 		if (cluster->stat.xstat_desc == NULL) {
 			rte_free(cluster->stat.xstat_count);
Signature · 1 line
2.51.0