1 Star 0 Fork 76

mds.lanruo/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0095-net-cnxk-fix-possible-null-dereference-in-telemetry.patch 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
liudongdong3 提交于 2022-06-16 16:03 . sync patches from 22.07
From d3078f7a0fe21d94fa8d6027f2541311a990585a Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Fri, 13 May 2022 10:53:57 +0800
Subject: [PATCH 095/122] net/cnxk: fix possible null dereference in telemetry
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The return value of rte_tel_data_alloc() may be null pointer.
Add missing check vs null.
Fixes: 5ea354a1f2cc ("net/cnxk: support telemetry")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
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.22.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mdslanruo/dpdk.git
git@gitee.com:mdslanruo/dpdk.git
mdslanruo
dpdk
dpdk
master

搜索帮助