From: wenxuanx.wu@intel.com
To: wisamm@nvidia.com, dev@dpdk.org
Cc: Wenxuan Wu <wenxuanx.wu@intel.com>, stable@dpdk.org
Subject: [PATCH] app: fix gcc 12 array bounds warning
Date: Thu, 16 Jun 2022 18:26:13 +0800 [thread overview]
Message-ID: <20220616102613.131685-1-wenxuanx.wu@intel.com> (raw)
From: Wenxuan Wu <wenxuanx.wu@intel.com>
when n == 1000, and it would be overflow the array size of 4 bytes with
nul terminator. Change the logic to avoid this warning.
Fixes: 15c431864000 ("app/flow-perf: add packet forwarding support")
Cc: stable@dpdk.org
Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
---
app/test-flow-perf/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 56d43734e3..661d562158 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -1728,7 +1728,7 @@ pretty_number(uint64_t n, char *buf)
int i = 0;
int off = 0;
- while (n > 1000) {
+ while (n >= 1000) {
sprintf(p[i], "%03d", (int)(n % 1000));
n /= 1000;
i += 1;
--
2.25.1
next reply other threads:[~2022-06-16 10:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 10:26 wenxuanx.wu [this message]
2022-06-16 10:39 wenxuanx.wu
2022-06-16 13:16 ` David Marchand
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=20220616102613.131685-1-wenxuanx.wu@intel.com \
--to=wenxuanx.wu@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--cc=wisamm@nvidia.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).