1 Star 0 Fork 75

chenjiji09/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0280-cryptodev-fix-empty-devargs-parsing.patch 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
chenjiji09 提交于 2023-04-27 15:25 . fix empty devargs parsing
From 23320d21b4abc8f52c612768a8508443f77dfcd8 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Thu, 2 Mar 2023 07:50:07 +0000
Subject: cryptodev: fix empty devargs parsing
[ upstream commit 8146454c56636ba8af5263b57e1c4a9f67fd4a39 ]
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault in rte_cryptodev_pmd_parse_uint_arg()
when parse input args with 'only keys' (e.g. socket_id,
max_nb_queue_pairs).
For a similar reason, this patch fixes
rte_cryptodev_pmd_parse_name_arg().
Fixes: 9e6edea41805 ("cryptodev: add APIs to assist PMD initialisation")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
---
lib/cryptodev/cryptodev_pmd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index 739a0b3f34..9dab1ef7cd 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -19,6 +19,9 @@ rte_cryptodev_pmd_parse_name_arg(const char *key __rte_unused,
struct rte_cryptodev_pmd_init_params *params = extra_args;
int n;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
n = strlcpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
if (n >= RTE_CRYPTODEV_NAME_MAX_LEN)
return -EINVAL;
@@ -35,6 +38,10 @@ rte_cryptodev_pmd_parse_uint_arg(const char *key __rte_unused,
{
int i;
char *end;
+
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
errno = 0;
i = strtol(value, &end, 10);
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chenjiji09/dpdk.git
git@gitee.com:chenjiji09/dpdk.git
chenjiji09
dpdk
dpdk
master

搜索帮助