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 22B88A034C; Thu, 28 Apr 2022 15:22:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DDF734283B; Thu, 28 Apr 2022 15:22:05 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id AF10A42821 for ; Thu, 28 Apr 2022 15:21:57 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Kpx911t3XzhYZW; Thu, 28 Apr 2022 21:21:41 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 28 Apr 2022 21:21:55 +0800 From: Chengwen Feng To: , , , , , , CC: Subject: [PATCH v2 9/9] net/cnxk: fix telemetry possible null pointer access Date: Thu, 28 Apr 2022 21:16:00 +0800 Message-ID: <20220428131600.41032-10-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220428131600.41032-1-fengchengwen@huawei.com> References: <20220416010747.40714-1-fengchengwen@huawei.com> <20220428131600.41032-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected 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 The return value of rte_tel_data_alloc() may be null pointer, in this patch, the null check function is added. Fixes: 5ea354a1f2cc ("net/cnxk: support telemetry") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- drivers/net/cnxk/cnxk_ethdev_telemetry.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/cnxk/cnxk_ethdev_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_telemetry.c index 83bc65848c..4fd9048643 100644 --- a/drivers/net/cnxk/cnxk_ethdev_telemetry.c +++ b/drivers/net/cnxk/cnxk_ethdev_telemetry.c @@ -49,6 +49,8 @@ ethdev_tel_handle_info(const char *cmd __rte_unused, rte_tel_data_add_dict_int(d, "n_ports", n_ports); i_data = rte_tel_data_alloc(); + if (i_data == NULL) + return -ENOMEM; rte_tel_data_start_array(i_data, RTE_TEL_U64_VAL); for (i = 0; i < RTE_MAX_ETHPORTS; i++) { -- 2.33.0