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: 915cdc075dba ("baseband/la12xx: support multiple modems")
Cc: sta...@dpdk.org

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

diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c 
b/drivers/baseband/la12xx/bbdev_la12xx.c
index bb754a5395..19c526ddd7 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -936,6 +936,9 @@ parse_integer_arg(const char *key __rte_unused,
        int i;
        char *end;
 
+       if (value == NULL)
+               return -EINVAL;
+
        errno = 0;
 
        i = strtol(value, &end, 10);
-- 
2.17.1

Reply via email to