graph_stats: do not use a possibly NULL Pointer
PATCH 1/1 graph_stats: do not use a possibly NULL Pointer
Use stats only after it was checked not to be NULL.
--- lib/graph/graph_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/graph/graph_stats.c +1 -1
@@ -119,8 +119,8 @@ stats_mem_init(struct cluster *cluster, cluster_node_size =RTE_ALIGN (cluster_node_size,RTE_CACHE_LINE_SIZE ); stats =realloc (NULL , sz); -memset (stats,0 , sz);if (stats) { +memset (stats,0 , sz); stats->fn = fn; stats->cluster_node_size = cluster_node_size; stats->max_nodes =0 ;
Signature · 1 line
2.29.2
Quoted 2 lines · Thierry Herbelot
Use stats only after it was checked not to be NULL.
Please change the subject to graph: ......
With the above fix:
Quoted 28 lines
Fixes af1ae8b6a32c9 ("graph: implement stats")Cc Jerin Jacob <[email protected]>Cc Kiran Kumar K <[email protected]>Signed-off-by Thierry Herbelot <[email protected]>--- lib/graph/graph_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/graph/graph_stats.c +1
-2@@ -119,8 +119,8 @@ stats_mem_init(struct cluster *cluster, cluster_node_size =RTE_ALIGN (cluster_node_size,RTE_CACHE_LINE_SIZE ); stats =realloc (NULL , sz); -memset (stats,0 , sz);if (stats) { +memset (stats,0 , sz); stats->fn = fn; stats->cluster_node_size = cluster_node_size; stats->max_nodes =0 ; --2.29.2
PATCH v2 1/1 graph: do not use a possibly NULL Pointer
In reply to Thierry HerbelotUse stats only after it was checked not to be NULL.
--
V2: reword patch title
--- lib/graph/graph_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/graph/graph_stats.c +1 -1
@@ -119,8 +119,8 @@ stats_mem_init(struct cluster *cluster, cluster_node_size =RTE_ALIGN (cluster_node_size,RTE_CACHE_LINE_SIZE ); stats =realloc (NULL , sz); -memset (stats,0 , sz);if (stats) { +memset (stats,0 , sz); stats->fn = fn; stats->cluster_node_size = cluster_node_size; stats->max_nodes =0 ;
Signature · 1 line
2.29.2
Re: [dpdk-dev] [PATCH v2] graph: do not use a possibly NULL Pointer
Quoted 20 lines · Thierry Herbelot
Use stats only after it was checked not to be NULL.
Fixes af1ae8b6a32c9 ("graph: implement stats")Cc Jerin Jacob <[email protected]>Cc Kiran Kumar K <[email protected]>Signed-off-by Thierry Herbelot <[email protected]>--
V2: reword patch title--- lib/graph/graph_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/graph/graph_stats.c +0
-0
lib/graph/graph_stats.c stats_mem_init(struct cluster *cluster, · line 126
Quoted 9 lines
lib/graph/graph_stats.c +1
-1@@ -119,8 +119,8 @@ stats_mem_init(struct cluster *cluster, cluster_node_size =RTE_ALIGN (cluster_node_size,RTE_CACHE_LINE_SIZE ); stats =realloc (NULL , sz); -memset (stats,0 , sz);if (stats) { +memset (stats,0 , sz); stats->fn = fn; stats->cluster_node_size = cluster_node_size; stats->max_nodes =0 ;
Please update your patches status in patchwork when submitting new revisions.
Besides, the same fix had been posted by Min Hu:
http://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
Signature · 1 line
David Marchand