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: 517ed6e2d590 ("net/mana: add basic driver with build environment")
Cc: sta...@dpdk.org

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

diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c
index 8a782c0d63..9c097c02ba 100644
--- a/drivers/net/mana/mana.c
+++ b/drivers/net/mana/mana.c
@@ -750,6 +750,9 @@ mana_arg_parse_callback(const char *key, const char *val, 
void *private)
                return 1;
        }
 
+       if (val == NULL)
+               return -EINVAL;
+
        ret = rte_ether_unformat_addr(val, &conf->mac_array[conf->index]);
        if (ret) {
                DRV_LOG(ERR, "Invalid MAC address %s", val);
-- 
2.17.1

Reply via email to