From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 24974A0A0A for ; Mon, 24 May 2021 11:31:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F75D41113; Mon, 24 May 2021 11:31:46 +0200 (CEST) Received: from proxy.6wind.com (host.78.145.23.62.rev.coltfrance.com [62.23.145.78]) by mails.dpdk.org (Postfix) with ESMTP id C5C314003C; Mon, 24 May 2021 11:31:43 +0200 (CEST) Received: from localhost (unknown [10.16.0.39]) by proxy.6wind.com (Postfix) with ESMTP id A8F559B4A9C; Mon, 24 May 2021 11:31:43 +0200 (CEST) From: Thierry Herbelot To: dev@dpdk.org Cc: Thierry Herbelot , Thomas Monjalon , stable@dpdk.org, Jerin Jacob , Kiran Kumar K Date: Mon, 24 May 2021 11:31:36 +0200 Message-Id: <20210524093136.20525-1-thierry.herbelot@6wind.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210524085850.16095-1-thierry.herbelot@6wind.com> References: <20210524085850.16095-1-thierry.herbelot@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v2] graph: do not use a possibly NULL Pointer X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Use stats only after it was checked not to be NULL. Fixes: af1ae8b6a32c9 ("graph: implement stats") Cc: stable@dpdk.org Cc: Jerin Jacob Cc: Kiran Kumar K Signed-off-by: Thierry Herbelot -- V2: reword patch title --- lib/graph/graph_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c index 125e08d73290..a52994f0f61e 100644 --- a/lib/graph/graph_stats.c +++ b/lib/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.29.2