[PATCH 11/12] app/flow-perf: fix build with GCC 12

David Marchand david.marchand at redhat.com
Wed Jun 8 14:20:49 CEST 2022


On Wed, Jun 8, 2022 at 11:03 AM Wisam Monther <wisamm at nvidia.com> wrote:
>
> Hi David,
>
> > -----Original Message-----
> > From: David Marchand <david.marchand at redhat.com>
> > Sent: Wednesday, May 18, 2022 1:17 PM
> > To: dev at dpdk.org
> > Cc: NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas at monjalon.net>;
> > ferruh.yigit at xilinx.com; stable at dpdk.org; Wisam Monther
> > <wisamm at nvidia.com>
> > Subject: [PATCH 11/12] app/flow-perf: fix build with GCC 12
> >
> > GCC 12 raises the following warning:
> >
> > ../app/test-flow-perf/main.c: In function ‘start_forwarding’:
> > ../app/test-flow-perf/main.c:1737:28: error: ‘sprintf’ may write a
> >     terminating nul past the end of the destination
> >     [-Werror=format-overflow=]
> >  1737 |         sprintf(p[i++], "%d", (int)n);
> >       |                            ^
> > In function ‘pretty_number’,
> >     inlined from ‘packet_per_second_stats’ at
> >         ../app/test-flow-perf/main.c:1792:4,
> >     inlined from ‘start_forwarding’ at
> >         ../app/test-flow-perf/main.c:1831:3:
> > [...]
> >
> > We can simplify this code and rely on libc integer formatting via this system
> > locales.
> >
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: David Marchand <david.marchand at redhat.com>
> > ---
>
> I've tested the patch and reviewed it, it's working fine, so thank you for that.
> One comment
> The initial value of 0 is 000
>
> Example:
> CMD: ./dpdk-test-flow-perf -n 4 -a <PCI> -- ingress --group=1 --ether --queue --rules-count=200000 --enable-fwd
>   core               tx         tx drops               rx
> ------ ---------------- ---------------- ----------------
>      1              000              000              000
>
> Can you handle this to be single 0 instead of not needed leading zeros?

Hum, I don't remember why I added this precision...
This should be just a matter of changing the format from %'16.3s to
%'16s, can you confirm?

-- 
David Marchand



More information about the stable mailing list