Acked-by: Liron Himi <[email protected]>
-----Original Message-----
From: Chengwen Feng <[email protected]>
Sent: Monday, 20 March 2023 11:21
To: [email protected]; [email protected]; Zyta Szpak <[email protected]>;
Liron Himi <[email protected]>; Dmitri Epshtein <[email protected]>; Natalie
Samsonov <[email protected]>; Andrzej Ostruszka <[email protected]>; Yelena
Krivosheev <[email protected]>
Cc: [email protected]
Subject: [EXT] [PATCH v2 22/44] net/mvneta: fix segment fault when parse devargs
External Email
----------------------------------------------------------------------
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: 4ccc8d770d3b ("net/mvneta: add PMD skeleton")
Cc: [email protected]
Signed-off-by: Chengwen Feng <[email protected]>
---
drivers/net/mvneta/mvneta_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/mvneta/mvneta_ethdev.c
b/drivers/net/mvneta/mvneta_ethdev.c
index d7953ac7cb..babe825ff9 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -91,6 +91,9 @@ mvneta_ifnames_get(const char *key __rte_unused, const char
*value, {
struct mvneta_ifnames *ifnames = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
ifnames->names[ifnames->idx++] = value;
return 0;
--
2.17.1