net/softnic: fix null dereference in arguments parsing
authorDapeng Yu <dapengx.yu@intel.com>
Tue, 27 Jul 2021 08:14:59 +0000 (16:14 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 30 Jul 2021 11:32:15 +0000 (13:32 +0200)
commit51799b4f971982bc0757cf8a11940eb538b1af57
tree2c35f702fbba1a3da5a24370d47d998296f5fab3
parent4e30586dcdf09e670f2e3c6b58c919f6b887d431
net/softnic: fix null dereference in arguments parsing

When there is no "firmware" in arguments, the "firmware" pointer is
null, and will be dereferenced by rte_strscpy().

This patch moves the code block which copies character string from
"firmware" to "p->firmware" into the "if" statements where "firmware"
argument exists and it is duplicated successfully.

Coverity issue: 372136
Fixes: d8f852f5f369 ("net/softnic: fix memory leak in arguments parsing")
Cc: stable@dpdk.org
Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
drivers/net/softnic/rte_eth_softnic.c