[PATCH v2 11/44] net/dpaa2: fix segment fault when parse devargs
Chengwen Feng
fengchengwen at huawei.com
Mon Mar 20 10:20:37 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: 536db938a444 ("net/cxgbe: add devargs to control filtermode and filtermask")
Cc: stable at dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
drivers/net/dpaa2/dpaa2_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 679f33ae1a..c54e10f3b7 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -2545,6 +2545,9 @@ static int
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
More information about the dev
mailing list