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 6B588A050B; Sat, 16 Apr 2022 03:13:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E6F64161A; Sat, 16 Apr 2022 03:13:41 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 23E2E4067E for ; Sat, 16 Apr 2022 03:13:36 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KgFWb21JZzFplq; Sat, 16 Apr 2022 09:11:07 +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; Sat, 16 Apr 2022 09:13:34 +0800 From: Chengwen Feng To: , , , , , , CC: Subject: [PATCH 3/3] net/cnxk: fix telemetry possible null pointer access Date: Sat, 16 Apr 2022 09:07:47 +0800 Message-ID: <20220416010747.40714-4-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220416010747.40714-1-fengchengwen@huawei.com> References: <20220416010747.40714-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: dggems703-chm.china.huawei.com (10.3.19.180) 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