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: f7be70e5130e ("net/octeontx: add net device probe and remove")
Cc: [email protected]
Signed-off-by: Chengwen Feng <[email protected]>
---
drivers/net/octeontx/octeontx_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/octeontx/octeontx_ethdev.c
b/drivers/net/octeontx/octeontx_ethdev.c
index d52a3e73d5..d11f359c7b 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -70,6 +70,9 @@ parse_integer_arg(const char *key __rte_unused,
{
int *i = (int *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
*i = atoi(value);
if (*i < 0) {
octeontx_log_err("argument has to be positive.");
--
2.17.1