[PATCH v2 43/44] mempool/cnxk: fix segment fault when parse devargs
Chengwen Feng
fengchengwen at huawei.com
Mon Mar 20 10:21:09 CET 2023
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: 0a50a5aad299 ("mempool/cnxk: add device probe/remove")
Cc: stable at dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
drivers/mempool/cnxk/cnxk_mempool.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mempool/cnxk/cnxk_mempool.c b/drivers/mempool/cnxk/cnxk_mempool.c
index 78caf987d0..d803e5928d 100644
--- a/drivers/mempool/cnxk/cnxk_mempool.c
+++ b/drivers/mempool/cnxk/cnxk_mempool.c
@@ -36,6 +36,9 @@ parse_max_pools_handler(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = rte_align32pow2(atoi(value));
if (val < npa_aura_size_to_u32(NPA_AURA_SZ_128))
val = 128;
--
2.17.1
More information about the dev
mailing list