Sync some patchs from upstreaming and modifies are as follow: 1. The rte_kvargs_process() was used to parse KV pairs, it also supports to parse 'only keys' 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'. 2. The MAP_FAILED should be used to determine whether the mapping is successful but not NULL. This patch fix it. (cherry picked from commit dfaed15bf9253e6b71dda7639806c0b265164a9e)
39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
From db5368482035c920449a75d336afd3622044ee89 Mon Sep 17 00:00:00 2001
|
|
From: Chengwen Feng <fengchengwen@huawei.com>
|
|
Date: Thu, 2 Mar 2023 07:50:12 +0000
|
|
Subject: raw/skeleton: fix empty devargs parsing
|
|
|
|
[ upstream commit 11da6149224a8de53d2ddd2aacba7b158cc4e3b4 ]
|
|
|
|
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'
|
|
(e.g. self_test).
|
|
|
|
Fixes: 55ca1b0f2151 ("raw/skeleton: add test cases")
|
|
Cc: stable@dpdk.org
|
|
|
|
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
|
|
---
|
|
drivers/raw/skeleton/skeleton_rawdev.c | 2 ++
|
|
1 file changed, 2 insertions(+)
|
|
|
|
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
|
|
index 16ecae3d92..a49e000146 100644
|
|
--- a/drivers/raw/skeleton/skeleton_rawdev.c
|
|
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
|
|
@@ -659,6 +659,8 @@ skeldev_get_selftest(const char *key __rte_unused,
|
|
void *opaque)
|
|
{
|
|
int *flag = opaque;
|
|
+ if (value == NULL || opaque == NULL)
|
|
+ return -EINVAL;
|
|
*flag = atoi(value);
|
|
return 0;
|
|
}
|
|
--
|
|
2.23.0
|
|
|