From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id EAD181BBBC for ; Fri, 27 Oct 2017 11:05:01 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Oct 2017 02:04:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,304,1505804400"; d="scan'208";a="167793938" Received: from silpixa00381635.ir.intel.com (HELO silpixa00381635.ger.corp.intel.com) ([10.237.222.149]) by fmsmga005.fm.intel.com with ESMTP; 27 Oct 2017 02:04:56 -0700 From: Jasvinder Singh To: dev@dpdk.org Cc: john.mcnamara@intel.com Date: Fri, 27 Oct 2017 10:17:35 +0100 Message-Id: <20171027091735.146399-1-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.9.3 Subject: [dpdk-dev] [PATCH] app/testpmd: fix memory access error for metering CLI X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 09:05:02 -0000 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 --- 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