> -----Original Message-----
> From: Min Hu (Connor) <[email protected]>
> Sent: Thursday, April 22, 2021 5:22 PM
> To: [email protected]
> Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>;
> Kiran Kumar Kokkilagadda <[email protected]>
> Subject: [EXT] [PATCH 2/2] graph: fix dereferencing null pointer
>
> External Email
>
> ----------------------------------------------------------------------
> From: HongBo Zheng <[email protected]>
>
> In function 'stats_mem_init', pointer 'stats' should be confirmed not null
> before
> memset it.
>
> Fixes: af1ae8b6a32c ("graph: implement stats")
> Cc: [email protected]
>
> Signed-off-by: HongBo Zheng <[email protected]>
> Signed-off-by: Min Hu (Connor) <[email protected]>
> ---
> lib/librte_graph/graph_stats.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_graph/graph_stats.c b/lib/librte_graph/graph_stats.c
> index
> f698bb3..bdc8652 100644
> --- a/lib/librte_graph/graph_stats.c
> +++ b/lib/librte_graph/graph_stats.c
> @@ -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.7.4
Reviewed-by: Kiran Kumar K <[email protected]>