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: 8d1d9070bbe9 ("event/dlb2: optimize producer port probing") Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS") Cc: sta...@dpdk.org Signed-off-by: Chengwen Feng <fengcheng...@huawei.com> --- drivers/event/dlb2/dlb2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 60c5cd4804..d436cf852a 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -329,6 +329,9 @@ set_numa_node(const char *key __rte_unused, const char *value, void *opaque) int *socket_id = opaque; int ret; + if (value == NULL) + return -EINVAL; + ret = dlb2_string_to_int(socket_id, value); if (ret < 0) return ret; @@ -542,7 +545,7 @@ set_cos_bw(const char *key __rte_unused, { struct dlb2_cos_bw *cos_bw = opaque; - if (opaque == NULL) { + if (value == NULL || opaque == NULL) { DLB2_LOG_ERR("NULL pointer\n"); return -EINVAL; } -- 2.17.1