[PATCH v2 16/44] net/iavf: fix segment fault when parse devargs
Chengwen Feng
fengchengwen at huawei.com
Mon Mar 20 10:20:42 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: b14e8a57b9fe ("net/iavf: support quanta size configuration")
Fixes: 4cce7422dd38 ("net/iavf: stop PCI probe in DCF mode")
Cc: stable at dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
drivers/net/iavf/iavf_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 3196210f2c..654741b71f 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -2185,6 +2185,9 @@ parse_u16(__rte_unused const char *key, const char *value, void *args)
u16 *num = (u16 *)args;
u16 tmp;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
tmp = strtoull(value, NULL, 10);
if (errno || !tmp) {
@@ -2815,6 +2818,9 @@ static int
iavf_dcf_cap_check_handler(__rte_unused const char *key,
const char *value, __rte_unused void *opaque)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (strcmp(value, "dcf"))
return -1;
--
2.17.1
More information about the dev
mailing list