DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jasvinder Singh <jasvinder.singh@intel.com>
To: dev@dpdk.org
Cc: john.mcnamara@intel.com
Subject: [dpdk-dev] [PATCH] app/testpmd: fix memory access error for metering CLI
Date: Fri, 27 Oct 2017 10:17:35 +0100	[thread overview]
Message-ID: <20171027091735.146399-1-jasvinder.singh@intel.com> (raw)

Fix memory access (out of bounds write) error, color and
action assignments.

Coverity issue: 198437
Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and policing")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 app/test-pmd/cmdline_mtr.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index 82b0ddf..d8d806d 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -802,17 +802,15 @@ static void cmd_set_port_meter_policer_action_parsed(void *parsed_result,
 		color = RTE_MTR_GREEN;
 	else if (strcmp(c, "Y") == 0)
 		color = RTE_MTR_YELLOW;
-	else if (strcmp(c, "Y") == 0)
-		color = RTE_MTR_RED;
 	else
-		color = RTE_MTR_COLORS;
+		color = RTE_MTR_RED;
 
 	/* Action */
 	if (strcmp(a, "G") == 0)
 		action[color] = MTR_POLICER_ACTION_COLOR_GREEN;
 	else if (strcmp(a, "Y") == 0)
 		action[color] = MTR_POLICER_ACTION_COLOR_YELLOW;
-	else if (strcmp(a, "Y") == 0)
+	else if (strcmp(a, "R") == 0)
 		action[color] = MTR_POLICER_ACTION_COLOR_RED;
 	else
 		action[color] = MTR_POLICER_ACTION_DROP;
-- 
2.9.3

             reply	other threads:[~2017-10-27  9:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27  9:17 Jasvinder Singh [this message]
2017-11-07  6:29 ` Ferruh Yigit
2017-11-07  6:31   ` Ferruh Yigit

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=20171027091735.146399-1-jasvinder.singh@intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@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 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).