Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | success | coding style OK |
Commit Message
fengchengwen
March 20, 2023, 9:20 a.m. UTC
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: 67fc3ff97c39 ("net/pfe: introduce basic functions")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/pfe/pfe_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c index 0352a57950..6e09c9443b 100644 --- a/drivers/net/pfe/pfe_ethdev.c +++ b/drivers/net/pfe/pfe_ethdev.c @@ -888,6 +888,9 @@ parse_integer_arg(const char *key __rte_unused, char *end; errno = 0; + if (value == NULL) + return -EINVAL; + i = strtol(value, &end, 10); if (*end != 0 || errno != 0 || i < 0 || i > 1) { PFE_PMD_ERR("Supported Port IDS are 0 and 1");