From patchwork Thu May 6 07:16:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 92987 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 75A4CA0524; Thu, 6 May 2021 09:16:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E2EAE410F3; Thu, 6 May 2021 09:16:30 +0200 (CEST) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by mails.dpdk.org (Postfix) with ESMTP id 1A9B8410F2 for ; Thu, 6 May 2021 09:16:29 +0200 (CEST) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FbPvw1gLhzklS6; Thu, 6 May 2021 15:14:20 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Thu, 6 May 2021 15:16:25 +0800 From: "Min Hu (Connor)" To: CC: , , , , Date: Thu, 6 May 2021 15:16:27 +0800 Message-ID: <1620285387-42792-3-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1620285387-42792-1-git-send-email-humin29@huawei.com> References: <1619092340-4047-1-git-send-email-humin29@huawei.com> <1620285387-42792-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2 2/2] graph: fix dereferencing null pointer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: HongBo Zheng In function 'stats_mem_init', pointer 'stats' should be confirmed not null before memset it. Fixes: af1ae8b6a32c ("graph: implement stats") Cc: stable@dpdk.org Signed-off-by: HongBo Zheng Signed-off-by: Min Hu (Connor) Reviewed-by: Jerin Jacob Reviewed-by: David Marchand --- 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 30e295d..aa70929 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;