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: a25d39a3eb69 ("net/netvsc: allow tuning latency with devargs")
Cc: sta...@dpdk.org

Signed-off-by: Chengwen Feng <fengcheng...@huawei.com>
---
 drivers/net/netvsc/hn_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index d0bbc0a4c0..e13eb03176 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -157,6 +157,9 @@ static int hn_set_parameter(const char *key, const char 
*value, void *opaque)
        char *endp = NULL;
        unsigned long v;
 
+       if (value == NULL)
+               return -EINVAL;
+
        v = strtoul(value, &endp, 0);
        if (*value == '\0' || *endp != '\0') {
                PMD_DRV_LOG(ERR, "invalid parameter %s=%s", key, value);
-- 
2.17.1

Reply via email to