DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/5] app/testpmd: fix array bounds checks
Date: Tue, 10 Jan 2017 14:08:26 +0100	[thread overview]
Message-ID: <4bf4692b3d38d6f807855ad16d4223ba06107753.1484046037.git.adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <cover.1484046037.git.adrien.mazarguil@6wind.com>

This commit addresses several obvious issues reported by Coverity (139596,
139597, 139598 and 139599) with array bounds checks in functions related to
the flow API.

Fixes: 938a184a1870 ("app/testpmd: implement basic support for flow API")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 app/test-pmd/config.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 9716ce7..e1af064 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -884,7 +884,7 @@ port_flow_new(const struct rte_flow_attr *attr,
 	do {
 		struct rte_flow_item *dst = NULL;
 
-		if ((unsigned int)item->type > RTE_DIM(flow_item) ||
+		if ((unsigned int)item->type >= RTE_DIM(flow_item) ||
 		    !flow_item[item->type].name)
 			goto notsup;
 		if (pf)
@@ -918,7 +918,7 @@ port_flow_new(const struct rte_flow_attr *attr,
 	do {
 		struct rte_flow_action *dst = NULL;
 
-		if ((unsigned int)action->type > RTE_DIM(flow_action) ||
+		if ((unsigned int)action->type >= RTE_DIM(flow_action) ||
 		    !flow_action[action->type].name)
 			goto notsup;
 		if (pf)
@@ -977,7 +977,7 @@ port_flow_complain(struct rte_flow_error *error)
 	char buf[32];
 	int err = rte_errno;
 
-	if ((unsigned int)error->type > RTE_DIM(errstrlist) ||
+	if ((unsigned int)error->type >= RTE_DIM(errstrlist) ||
 	    !errstrlist[error->type])
 		errstr = "unknown type";
 	else
@@ -1146,7 +1146,7 @@ port_flow_query(portid_t port_id, uint32_t rule,
 		printf("Flow rule #%u not found\n", rule);
 		return -ENOENT;
 	}
-	if ((unsigned int)action > RTE_DIM(flow_action) ||
+	if ((unsigned int)action >= RTE_DIM(flow_action) ||
 	    !flow_action[action].name)
 		name = "unknown";
 	else
-- 
2.1.4

  reply	other threads:[~2017-01-10 13:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10 13:08 [dpdk-dev] [PATCH 0/5] Assorted fixes for the flow API Adrien Mazarguil
2017-01-10 13:08 ` Adrien Mazarguil [this message]
2017-01-10 13:08 ` [dpdk-dev] [PATCH 2/5] ethdev: modify flow API's error setting function Adrien Mazarguil
2017-01-10 13:08 ` [dpdk-dev] [PATCH 3/5] ethdev: clarify MARK and FLAG actions in flow API Adrien Mazarguil
2017-01-10 13:08 ` [dpdk-dev] [PATCH 4/5] ethdev: clarify RSS action " Adrien Mazarguil
2017-01-10 13:08 ` [dpdk-dev] [PATCH 5/5] ethdev: define default item masks " Adrien Mazarguil
2017-01-11 15:57 ` [dpdk-dev] [PATCH 0/5] Assorted fixes for the " 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=4bf4692b3d38d6f807855ad16d4223ba06107753.1484046037.git.adrien.mazarguil@6wind.com \
    --to=adrien.mazarguil@6wind.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).