From mboxrd@z Thu Jan 1 00:00:00 1970 From: Helin Zhang Subject: [PATCH 3/6] i40e: fix problematic dereference Date: Thu, 21 Apr 2016 11:42:54 +0800 Message-ID: <1461210177-29330-4-git-send-email-helin.zhang@intel.com> References: <1461210177-29330-1-git-send-email-helin.zhang@intel.com> Cc: Helin Zhang To: dev@dpdk.org Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 96A6538EB for ; Thu, 21 Apr 2016 05:43:11 +0200 (CEST) In-Reply-To: <1461210177-29330-1-git-send-email-helin.zhang@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fix issue reported by Coverity. Coverity ID 13294: Dereference before null check. Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director") Signed-off-by: Helin Zhang --- drivers/net/i40e/i40e_rxtx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 31bfc44..4fd96fe 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -2981,13 +2981,15 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf) struct i40e_tx_queue *txq; const struct rte_memzone *tz = NULL; uint32_t ring_size; - struct rte_eth_dev *dev = pf->adapter->eth_dev; + struct rte_eth_dev *dev; if (!pf) { PMD_DRV_LOG(ERR, "PF is not available"); return I40E_ERR_BAD_PTR; } + dev = pf->adapter->eth_dev; + /* Allocate the TX queue data structure. */ txq = rte_zmalloc_socket("i40e fdir tx queue", sizeof(struct i40e_tx_queue), -- 2.5.0