[PATCH v2 40/44] event/octeontx: fix segment fault when parse devargs

Chengwen Feng fengchengwen at huawei.com
Mon Mar 20 10:21:06 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: 3516327e00fd ("event/octeontx: add selftest to device arguments")
Cc: stable at dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
 drivers/event/octeontx/ssovf_evdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index 650266b996..b9b5fa8668 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -717,6 +717,8 @@ static int
 ssovf_parsekv(const char *key __rte_unused, const char *value, void *opaque)
 {
 	int *flag = opaque;
+	if (value == NULL)
+		return -EINVAL;
 	*flag = !!atoi(value);
 	return 0;
 }
-- 
2.17.1



More information about the dev mailing list