All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	wei.dai@intel.com, stable@dpdk.org,
	Bernard Iremonger <bernard.iremonger@intel.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Rami Rosen <ramirose@gmail.com>
Subject: [dpdk-dev] [PATCH v2 4/5] app/testpmd: fix variable use before NULL check
Date: Fri,  5 Apr 2019 15:37:08 +0100	[thread overview]
Message-ID: <20190405143709.50352-5-bruce.richardson@intel.com> (raw)
In-Reply-To: <20190405143709.50352-1-bruce.richardson@intel.com>

The value returned from rte_eth_dev_tx_offload_name() function is used
for string comparison before being checked for NULL. Move the NULL check
up to be done first.

Coverity issue: 279438
Fixes: c73a9071877a ("app/testpmd: add commands to test new offload API")
Cc: wei.dai@intel.com
Cc: stable@dpdk.org
Cc: Bernard Iremonger <bernard.iremonger@intel.com>
Cc: Wenzhuo Lu <wenzhuo.lu@intel.com>

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Rami Rosen <ramirose@gmail.com>
---
 app/test-pmd/cmdline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ee50e4566..2155ff241 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -18306,13 +18306,13 @@ search_tx_offload(const char *name)
 	single_offload = 1;
 	for (bit = 0; bit < sizeof(single_offload) * CHAR_BIT; bit++) {
 		single_name = rte_eth_dev_tx_offload_name(single_offload);
+		if (single_name == NULL)
+			break;
 		if (!strcasecmp(single_name, name)) {
 			found = 1;
 			break;
 		} else if (!strcasecmp(single_name, "UNKNOWN"))
 			break;
-		else if (single_name == NULL)
-			break;
 		single_offload <<= 1;
 	}
 
-- 
2.20.1


  parent reply	other threads:[~2019-04-05 14:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05 13:45 [dpdk-dev] [PATCH 0/5] some small fixes Bruce Richardson
2019-04-05 13:45 ` [dpdk-dev] [PATCH 1/5] examples/vhost_scsi: fix header check for meson build Bruce Richardson
2019-04-05 13:45 ` [dpdk-dev] [PATCH 2/5] examples/vhost_scsi: fix missing NULL-check for parameter Bruce Richardson
2019-04-05 13:45 ` [dpdk-dev] [PATCH 3/5] net/i40e: fix dereference before NULL check in mbuf release Bruce Richardson
2019-04-05 14:08   ` Rami Rosen
2019-04-05 13:45 ` [dpdk-dev] [PATCH 4/5] app/testpmd: fix variable use before NULL check Bruce Richardson
2019-04-05 14:13   ` Rami Rosen
2019-04-05 13:45 ` [dpdk-dev] [PATCH 5/5] net/i40e: fix dereference before check when getting EEPROM Bruce Richardson
2019-04-05 14:19   ` Rami Rosen
2019-04-05 14:37 ` [dpdk-dev] [PATCH v2 0/5] some small fixes Bruce Richardson
2019-04-05 14:37   ` [dpdk-dev] [PATCH v2 1/5] examples/vhost_scsi: fix header check for meson build Bruce Richardson
2019-04-08  3:23     ` Tiwei Bie
2019-04-05 14:37   ` [dpdk-dev] [PATCH v2 2/5] examples/vhost_scsi: fix missing NULL-check for parameter Bruce Richardson
2019-04-08  3:31     ` Tiwei Bie
2019-04-08  9:37       ` Bruce Richardson
2019-04-05 14:37   ` [dpdk-dev] [PATCH v2 3/5] net/i40e: fix dereference before NULL check in mbuf release Bruce Richardson
2019-04-05 14:37   ` Bruce Richardson [this message]
2019-04-05 14:37   ` [dpdk-dev] [PATCH v2 5/5] net/i40e: fix dereference before check when getting EEPROM Bruce Richardson
2019-04-08  9:46 ` [dpdk-dev] [PATCH v3 0/5] some small fixes Bruce Richardson
2019-04-08  9:46   ` [dpdk-dev] [PATCH v3 1/5] examples/vhost_scsi: fix header check for meson build Bruce Richardson
2019-04-08  9:46   ` [dpdk-dev] [PATCH v3 2/5] examples/vhost_scsi: fix missing NULL-check for parameter Bruce Richardson
2019-04-09  1:53     ` Tiwei Bie
2019-04-08  9:46   ` [dpdk-dev] [PATCH v3 3/5] net/i40e: fix dereference before NULL check in mbuf release Bruce Richardson
2019-04-08  9:46   ` [dpdk-dev] [PATCH v3 4/5] app/testpmd: fix variable use before NULL check Bruce Richardson
2019-04-08  9:46   ` [dpdk-dev] [PATCH v3 5/5] net/i40e: fix dereference before check when getting EEPROM Bruce Richardson
2019-04-22 21:49   ` [dpdk-dev] [PATCH v3 0/5] some small fixes Thomas Monjalon

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=20190405143709.50352-5-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ramirose@gmail.com \
    --cc=stable@dpdk.org \
    --cc=wei.dai@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.