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: 001a520e419f ("net/mlx4: add port parameter")
Cc: sta...@dpdk.org

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

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index a54016f4a2..7c11f3a129 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -521,6 +521,9 @@ mlx4_arg_parse(const char *key, const char *val, struct 
mlx4_conf *conf)
 {
        unsigned long tmp;
 
+       if (val == NULL)
+               return -EINVAL;
+
        errno = 0;
        tmp = strtoul(val, NULL, 0);
        if (errno) {
-- 
2.17.1

Reply via email to