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: 135e0b71fa30 ("crypto/cnxk: add max queue pairs limit option")
Cc: [email protected]
Signed-off-by: Chengwen Feng <[email protected]>
---
drivers/crypto/cnxk/cnxk_cryptodev_devargs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_devargs.c
b/drivers/crypto/cnxk/cnxk_cryptodev_devargs.c
index c3e9bdb2d1..936bf8fbf4 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_devargs.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_devargs.c
@@ -16,6 +16,9 @@ parse_max_qps_limit(const char *key, const char *value, void
*extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = atoi(value);
if (val < CNXK_MAX_QPS_LIMIT_MIN || val > CNXK_MAX_QPS_LIMIT_MAX)
--
2.17.1