From: <skori@marvell.com>
To: Xiaoyun Li <xiaoyun.li@intel.com>
Cc: <dev@dpdk.org>, Sunil Kumar Kori <skori@marvell.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] app/testpmd: fix invalid memory access
Date: Tue, 12 Oct 2021 13:06:24 +0530 [thread overview]
Message-ID: <20211012073624.399404-1-skori@marvell.com> (raw)
From: Sunil Kumar Kori <skori@marvell.com>
During parsing of DSCP entries, memory is allocated and assgined
to *dscp_table. Later on, same memory is accessed using
*dscp_table[i++].
Due to higher precedence for array subscript, dscp_table[i++] will
be executed first which actually does not point to the same memory
which was allocated previously for DSCP table entries.
Cc: stable@dpdk.org
Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
app/test-pmd/cmdline_mtr.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index b5dcfdadcf..ad7ef6ad98 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -101,13 +101,13 @@ parse_dscp_table_entries(char *str, enum rte_color **dscp_table)
while (1) {
if (strcmp(token, "G") == 0 ||
strcmp(token, "g") == 0)
- *dscp_table[i++] = RTE_COLOR_GREEN;
+ (*dscp_table)[i++] = RTE_COLOR_GREEN;
else if (strcmp(token, "Y") == 0 ||
strcmp(token, "y") == 0)
- *dscp_table[i++] = RTE_COLOR_YELLOW;
+ (*dscp_table)[i++] = RTE_COLOR_YELLOW;
else if (strcmp(token, "R") == 0 ||
strcmp(token, "r") == 0)
- *dscp_table[i++] = RTE_COLOR_RED;
+ (*dscp_table)[i++] = RTE_COLOR_RED;
else {
free(*dscp_table);
return -1;
--
2.25.1
next reply other threads:[~2021-10-12 7:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 7:36 skori [this message]
2021-10-12 7:50 ` Li, Xiaoyun
2021-10-12 8:21 ` Sunil Kumar Kori
2021-10-12 8:33 ` [dpdk-dev] [PATCH v2 1/1] " skori
2021-10-19 16:11 ` Ferruh Yigit
-- strict thread matches above, loose matches on Subject: below --
2018-05-07 9:50 [dpdk-dev] [PATCH] " Qi Zhang
2018-05-08 6:24 ` Zhao1, Wei
2018-05-08 8:31 ` Zhang, Qi Z
2018-05-09 13:58 ` 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=20211012073624.399404-1-skori@marvell.com \
--to=skori@marvell.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--cc=xiaoyun.li@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).