DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Boyer <andrew.boyer@amd.com>
To: <dev@dpdk.org>
Cc: Andrew Boyer <andrew.boyer@amd.com>
Subject: [PATCH 2/2] net/ionic: fix up minor coverity issue in packet transmit
Date: Thu, 3 Nov 2022 06:49:09 -0700	[thread overview]
Message-ID: <20221103134909.21791-3-andrew.boyer@amd.com> (raw)
In-Reply-To: <20221103134909.21791-1-andrew.boyer@amd.com>

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(-)

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]);
 	}
-- 
2.17.1


  parent reply	other threads:[~2022-11-03 13:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 13:49 [PATCH 0/2] net/ionic: fix up minor coverity issues Andrew Boyer
2022-11-03 13:49 ` [PATCH 1/2] net/ionic: fix up minor coverity issue in queue allocation Andrew Boyer
2022-11-03 13:49 ` Andrew Boyer [this message]
2022-11-06  9:28 ` [PATCH 0/2] net/ionic: fix up minor coverity issues Andrew Rybchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221103134909.21791-3-andrew.boyer@amd.com \
    --to=andrew.boyer@amd.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).