From: Andy Pei Date: Thu, 23 May 2019 02:53:03 +0000 (+0800) Subject: net/ipn3ke: fix accessing variable before null check X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=320eecbc7f3d7fce7533482418d37803754bf533;p=dpdk.git net/ipn3ke: fix accessing variable before null check Check input argument "rte_eth_dev *ethdev", to be sure variable is not NULL before operating on it. Coverity issue: 337922 Fixes: 70d6b7f550f4 ("net/ipn3ke: add representor") Cc: stable@dpdk.org Signed-off-by: Andy Pei Acked-by: Rosen Xu --- diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c index f4529f63fe..01ad92e731 100644 --- a/drivers/net/ipn3ke/ipn3ke_representor.c +++ b/drivers/net/ipn3ke/ipn3ke_representor.c @@ -736,13 +736,16 @@ ipn3ke_afu_filter_ctrl(struct rte_eth_dev *ethdev, enum rte_filter_type filter_type, enum rte_filter_op filter_op, void *arg) { - struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev); - struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev); int ret = 0; + struct ipn3ke_hw *hw; + struct ipn3ke_rpst *rpst; if (ethdev == NULL) return -EINVAL; + hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev); + rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev); + if (hw->acc_flow) switch (filter_type) { case RTE_ETH_FILTER_GENERIC: