From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 15F8C1B53F; Fri, 5 Apr 2019 16:37:28 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 07:37:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,313,1549958400"; d="scan'208";a="140280847" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by orsmga003.jf.intel.com with ESMTP; 05 Apr 2019 07:37:26 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , qi.z.zhang@intel.com, stable@dpdk.org, Rami Rosen Date: Fri, 5 Apr 2019 15:37:07 +0100 Message-Id: <20190405143709.50352-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190405143709.50352-1-bruce.richardson@intel.com> References: <20190405134511.49066-1-bruce.richardson@intel.com> <20190405143709.50352-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 3/5] net/i40e: fix dereference before NULL check in mbuf release X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Apr 2019 14:37:29 -0000 Coverity flags that the txq variable is used before it's checked for NULL. Also fix typo in error message. Coverity issue: 195023 Fixes: 24853544c84c ("net/i40e: fix mbuf free in vector Tx") Cc: qi.z.zhang@intel.com CC: stable@dpdk.org Signed-off-by: Bruce Richardson Acked-By: Rami Rosen --- V2: Fix typo or copy/paste error while fixing main issue --- drivers/net/i40e/i40e_rxtx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 8f727fae6..282e18bc1 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -2423,13 +2423,13 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) struct rte_eth_dev *dev; uint16_t i; - dev = &rte_eth_devices[txq->port_id]; - if (!txq || !txq->sw_ring) { - PMD_DRV_LOG(DEBUG, "Pointer to rxq or sw_ring is NULL"); + PMD_DRV_LOG(DEBUG, "Pointer to txq or sw_ring is NULL"); return; } + dev = &rte_eth_devices[txq->port_id]; + /** * vPMD tx will not set sw_ring's mbuf to NULL after free, * so need to free remains more carefully. -- 2.20.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id CB03CA0679 for ; Fri, 5 Apr 2019 16:37:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CE6731B551; Fri, 5 Apr 2019 16:37:32 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 15F8C1B53F; Fri, 5 Apr 2019 16:37:28 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 07:37:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,313,1549958400"; d="scan'208";a="140280847" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by orsmga003.jf.intel.com with ESMTP; 05 Apr 2019 07:37:26 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , qi.z.zhang@intel.com, stable@dpdk.org, Rami Rosen Date: Fri, 5 Apr 2019 15:37:07 +0100 Message-Id: <20190405143709.50352-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190405143709.50352-1-bruce.richardson@intel.com> References: <20190405134511.49066-1-bruce.richardson@intel.com> <20190405143709.50352-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 3/5] net/i40e: fix dereference before NULL check in mbuf release X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190405143707.Ms-uCCcABnjmwq7c-Fn5K5u_DoGXS-5meArrzQiTlo8@z> Coverity flags that the txq variable is used before it's checked for NULL. Also fix typo in error message. Coverity issue: 195023 Fixes: 24853544c84c ("net/i40e: fix mbuf free in vector Tx") Cc: qi.z.zhang@intel.com CC: stable@dpdk.org Signed-off-by: Bruce Richardson Acked-By: Rami Rosen --- V2: Fix typo or copy/paste error while fixing main issue --- drivers/net/i40e/i40e_rxtx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 8f727fae6..282e18bc1 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -2423,13 +2423,13 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) struct rte_eth_dev *dev; uint16_t i; - dev = &rte_eth_devices[txq->port_id]; - if (!txq || !txq->sw_ring) { - PMD_DRV_LOG(DEBUG, "Pointer to rxq or sw_ring is NULL"); + PMD_DRV_LOG(DEBUG, "Pointer to txq or sw_ring is NULL"); return; } + dev = &rte_eth_devices[txq->port_id]; + /** * vPMD tx will not set sw_ring's mbuf to NULL after free, * so need to free remains more carefully. -- 2.20.1