[v3,3/5] net/i40e: fix dereference before NULL check in mbuf release

Message ID 20190408094640.46030-4-bruce.richardson@intel.com
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
  • some small fixes
Related show


Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson April 8, 2019, 9:46 a.m.
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 <bruce.richardson@intel.com>
Acked-by: Rami Rosen <ramirose@gmail.com>
 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");
+	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.