[2/2] net/ionic: fix up minor coverity issue in packet transmit

Message ID 20221103134909.21791-3-andrew.boyer@amd.com (mailing list archive)
State Accepted, archived
Delegated to: Andrew Rybchenko
Headers
Series net/ionic: fix up minor coverity issues |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS

Commit Message

Andrew Boyer Nov. 3, 2022, 1:49 p.m. UTC
  If tx_pkts is NULL, nb_pkts must be 0. Coverity doesn't know
this so it thinks this is a forward-NULL violation.
Make things more clear by checking for nb_pkts instead.

Coverity issue: 381614
Coverity issue: 381619
Fixes: e86a6fcc7cf3 ("net/ionic: add optimized non-scattered Rx/Tx")

Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>
---
 drivers/net/ionic/ionic_rxtx_sg.c     | 2 +-
 drivers/net/ionic/ionic_rxtx_simple.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/ionic/ionic_rxtx_sg.c b/drivers/net/ionic/ionic_rxtx_sg.c
index 2752ba2acd..ab8e56e91c 100644
--- a/drivers/net/ionic/ionic_rxtx_sg.c
+++ b/drivers/net/ionic/ionic_rxtx_sg.c
@@ -175,7 +175,7 @@  ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,
 		rte_prefetch0(&desc_base[q->head_idx]);
 	rte_prefetch0(IONIC_INFO_PTR(q, q->head_idx));
 
-	if (tx_pkts) {
+	if (nb_pkts) {
 		rte_mbuf_prefetch_part1(tx_pkts[0]);
 		rte_mbuf_prefetch_part2(tx_pkts[0]);
 	}
diff --git a/drivers/net/ionic/ionic_rxtx_simple.c b/drivers/net/ionic/ionic_rxtx_simple.c
index 0421fb32b2..5f81856256 100644
--- a/drivers/net/ionic/ionic_rxtx_simple.c
+++ b/drivers/net/ionic/ionic_rxtx_simple.c
@@ -148,7 +148,7 @@  ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		rte_prefetch0(&desc_base[q->head_idx]);
 	rte_prefetch0(&q->info[q->head_idx]);
 
-	if (tx_pkts) {
+	if (nb_pkts) {
 		rte_mbuf_prefetch_part1(tx_pkts[0]);
 		rte_mbuf_prefetch_part2(tx_pkts[0]);
 	}