[PATCH v2 30/44] common/mlx5: fix segment fault when parse devargs
Chengwen Feng
fengchengwen at huawei.com
Mon Mar 20 10:20:56 CET 2023
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 when parse input args with 'only keys'.
Fixes: ad435d320473 ("common/mlx5: add bus-agnostic layer")
Cc: stable at dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
drivers/common/mlx5/mlx5_common.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c
index 0ad14a48c7..e4cf829c14 100644
--- a/drivers/common/mlx5/mlx5_common.c
+++ b/drivers/common/mlx5/mlx5_common.c
@@ -365,6 +365,11 @@ devargs_class_handler(__rte_unused const char *key,
char *found;
char *refstr = NULL;
+ if (class_names == NULL) {
+ *ret = -EINVAL;
+ return *ret;
+ }
+
*ret = 0;
scratch = strdup(class_names);
if (scratch == NULL) {
--
2.17.1
More information about the dev
mailing list