patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] app: fix gcc 12 array bounds warning
@ 2022-06-16 10:39 wenxuanx.wu
  2022-06-16 13:16 ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: wenxuanx.wu @ 2022-06-16 10:39 UTC (permalink / raw)
  To: wisamm, dev, thomas; +Cc: stephen, wenxuanx.wu, stable

From: Wenxuan Wu <wenxuanx.wu@intel.com>

when n == 1000, and it would 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] app: fix gcc 12 array bounds warning
  2022-06-16 10:39 [PATCH] app: fix gcc 12 array bounds warning wenxuanx.wu
@ 2022-06-16 13:16 ` David Marchand
  0 siblings, 0 replies; 3+ messages in thread
From: David Marchand @ 2022-06-16 13:16 UTC (permalink / raw)
  To: Wenxuan Wu
  Cc: Wisam Jaddo, dev, Thomas Monjalon, Stephen Hemminger, dpdk stable

On Thu, Jun 16, 2022 at 12:40 PM <wenxuanx.wu@intel.com> wrote:
>
> From: Wenxuan Wu <wenxuanx.wu@intel.com>
>
> when n == 1000, and it would 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>

A different fix is already merged.
Please check: https://git.dpdk.org/dpdk/commit/?id=5fc2eece8d45


-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] app: fix gcc 12 array bounds warning
@ 2022-06-16 10:26 wenxuanx.wu
  0 siblings, 0 replies; 3+ messages in thread
From: wenxuanx.wu @ 2022-06-16 10:26 UTC (permalink / raw)
  To: wisamm, dev; +Cc: Wenxuan Wu, stable

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-16 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 10:39 [PATCH] app: fix gcc 12 array bounds warning wenxuanx.wu
2022-06-16 13:16 ` David Marchand
  -- strict thread matches above, loose matches on Subject: below --
2022-06-16 10:26 wenxuanx.wu

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).