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: cc0c5d251928 ("net/ena: make Tx completion timeout configurable")
Fixes: 8a7a73f26cc9 ("net/ena: support large LLQ headers")
Cc: [email protected]
Signed-off-by: Chengwen Feng <[email protected]>
---
drivers/net/ena/ena_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index efcb163027..82a6c75824 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -3444,6 +3444,9 @@ static int ena_process_uint_devarg(const char *key,
char *str_end;
uint64_t uint_value;
+ if (value == NULL)
+ return -EINVAL;
+
uint_value = strtoull(value, &str_end, 10);
if (value == str_end) {
PMD_INIT_LOG(ERR,
@@ -3482,6 +3485,9 @@ static int ena_process_bool_devarg(const char *key,
struct ena_adapter *adapter = opaque;
bool bool_value;
+ if (value == NULL)
+ return -EINVAL;
+
/* Parse the value. */
if (strcmp(value, "1") == 0) {
bool_value = true;
--
2.17.1