[PATCH] app/flow-perf: fix logic to add comma every three digits

Stephen Hemminger stephen at networkplumber.org
Sat Jun 11 01:45:22 CEST 2022


On Sat, 11 Jun 2022 03:36:43 +0530
Rahul Lakkireddy <rahul.lakkireddy at chelsio.com> wrote:

> Add comma after 1 in 1000 too, like 1,000. Also, since max uint64_t is
> a 20 digit number, increase space in temporary array to hold 20 digits.
> Fixes following warnings when using optimization=1 build flag with
> GCC 11.
> 
> ../app/test-flow-perf/main.c: In function ‘pretty_number’:
> ../app/test-flow-perf/main.c:1737:28: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
>          sprintf(p[i++], "%d", (int)n);
>                             ^
> ../app/test-flow-perf/main.c:1737:9: note: ‘sprintf’ output between 2 and 5 bytes into a destination of size 4
>          sprintf(p[i++], "%d", (int)n);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Bugzilla ID: 1029
> Fixes: 15c431864000 ("app/flow-perf: add packet forwarding support")
> Cc: stable at dpdk.org
> 
> Reported-by: Daxue Gao <daxuex.gao at intel.com>
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy at chelsio.com>

There was a better alternative proposed here:

https://patchwork.dpdk.org/project/dpdk/patch/20220518101657.1230416-12-david.marchand@redhat.com/


More information about the stable mailing list