Reviewed-by: John Daley johndale@cisco.com From: Chengwen Feng Date: Monday, March 20, 2023 at 2:28 AM To: thomas@monjalon.net , ferruh.yigit@amd.com , John Daley (johndale) , Hyong Youb Kim (hyonkim) Cc: dev@dpdk.org Subject: [PATCH v2 13/44] net/enic: fix segment fault when parse devargs 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: 93fb21fdbe23 ("net/enic: enable overlay offload for VXLAN and GENEVE") Fixes: e39c2756e21a ("net/enic: add devarg to specify ingress VLAN rewrite mode") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- drivers/net/enic/enic_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index cdf0915591..b67016e0a3 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -1148,6 +1148,9 @@ static int enic_parse_zero_one(const char *key, struct enic *enic; bool b; + if (value == NULL) + return -EINVAL; + enic = (struct enic *)opaque; if (strcmp(value, "0") == 0) { b = false; @@ -1173,6 +1176,9 @@ static int enic_parse_ig_vlan_rewrite(__rte_unused const char *key, { struct enic *enic; + if (value == NULL) + return -EINVAL; + enic = (struct enic *)opaque; if (strcmp(value, "trunk") == 0) { /* Trunk mode: always tag */ -- 2.17.1