Skip to content

Commit

Permalink
graph: fix null dereference in stats
Browse files Browse the repository at this point in the history
[ upstream commit 2d2bf7d ]

In function 'stats_mem_init', pointer 'stats' should
be confirmed not null before memset it.

Fixes: af1ae8b ("graph: implement stats")

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
  • Loading branch information
Hongbo Zheng authored and bluca committed Jul 12, 2021
1 parent 3d328cf commit 7af7de2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/librte_graph/graph_stats.c
Expand Up @@ -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;
Expand Down

0 comments on commit 7af7de2

Please sign in to comment.