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: 549343c25db8 ("net/idpf: support device initialization")
Cc: sta...@dpdk.org

Signed-off-by: Chengwen Feng <fengcheng...@huawei.com>
---
 drivers/net/idpf/idpf_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 46aec6ae37..105dcc8744 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -903,6 +903,9 @@ parse_vport(const char *key, const char *value, void *args)
        struct idpf_devargs *devargs = args;
        const char *pos = value;
 
+       if (value == NULL)
+               return -EINVAL;
+
        devargs->req_vport_nb = 0;
 
        if (*pos == '[')
@@ -936,6 +939,9 @@ parse_bool(const char *key, const char *value, void *args)
        char *end;
        int num;
 
+       if (value == NULL)
+               return -EINVAL;
+
        errno = 0;
 
        num = strtoul(value, &end, 10);
-- 
2.17.1

Reply via email to