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: 9e2f8ca6c224 ("dma/dpaa2: support DMA operations")
Cc: sta...@dpdk.org

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

diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c
index d5a5f08ecc..14c0d28181 100644
--- a/drivers/dma/dpaa2/dpaa2_qdma.c
+++ b/drivers/dma/dpaa2/dpaa2_qdma.c
@@ -1169,6 +1169,9 @@ 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