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: 536db938a444 ("net/cxgbe: add devargs to control filtermode and 
filtermask")
Cc: sta...@dpdk.org

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

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 679f33ae1a..c54e10f3b7 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -2545,6 +2545,9 @@ static int
 check_devargs_handler(__rte_unused const char *key, const char *value,
                      __rte_unused void *opaque)
 {
+       if (value == NULL)
+               return -EINVAL;
+
        if (strcmp(value, "1"))
                return -1;
 
-- 
2.17.1

Reply via email to