[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z4hTPNEGreEo6igW@mini-arch>
Date: Wed, 15 Jan 2025 16:30:52 -0800
From: Stanislav Fomichev <stfomichev@...il.com>
To: "Song, Yoong Siang" <yoong.siang.song@...el.com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>,
Willem de Bruijn <willemb@...gle.com>,
"Bezdeka, Florian" <florian.bezdeka@...mens.com>,
Donald Hunter <donald.hunter@...il.com>,
Jonathan Corbet <corbet@....net>, Bjorn Topel <bjorn@...nel.org>,
"Karlsson, Magnus" <magnus.karlsson@...el.com>,
"Fijalkowski, Maciej" <maciej.fijalkowski@...el.com>,
Jonathan Lemon <jonathan.lemon@...il.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
Alexei Starovoitov <ast@...nel.org>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
"Damato, Joe" <jdamato@...tly.com>,
Stanislav Fomichev <sdf@...ichev.me>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Mina Almasry <almasrymina@...gle.com>,
Daniel Jurgens <danielj@...dia.com>,
Andrii Nakryiko <andrii@...nel.org>,
Eduard Zingerman <eddyz87@...il.com>,
Mykola Lysenko <mykolal@...com>,
Martin KaFai Lau <martin.lau@...ux.dev>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
KP Singh <kpsingh@...nel.org>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Shuah Khan <shuah@...nel.org>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
"Nguyen, Anthony L" <anthony.l.nguyen@...el.com>,
"Kitszel, Przemyslaw" <przemyslaw.kitszel@...el.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"linux-stm32@...md-mailman.stormreply.com" <linux-stm32@...md-mailman.stormreply.com>,
"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>,
"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>,
"xdp-hints@...-project.net" <xdp-hints@...-project.net>
Subject: Re: [PATCH bpf-next v5 2/4] selftests/bpf: Add launch time request
to xdp_hw_metadata
On 01/15, Song, Yoong Siang wrote:
> On Wednesday, January 15, 2025 10:57 PM, Daniel Borkmann <daniel@...earbox.net> wrote:
> >On 1/14/25 4:27 PM, Song Yoong Siang wrote:
> >[...]
> >> + /* Add mqprio qdisc with TC and hardware queue one-to-one mapping */
> >> + char map[256] = {0};
> >> + char queues[256] = {0};
> >> +
> >> + for (i = 0; i < rxq; i++) {
> >> + char buf[8];
> >> +
> >> + snprintf(buf, sizeof(buf), "%d ", i);
> >> + strcat(map, buf);
> >> +
> >> + snprintf(buf, sizeof(buf), "1@%d ", i);
> >> + strcat(queues, buf);
> >> + }
> >> + run_command("sudo tc qdisc add dev %s handle 8001: parent root mqprio
> >num_tc %d map %s queues %s hw 0",
> >> + ifname, rxq, map, queues);
> >
> >Fyi, above triggers selftest build errors:
> >
> > xdp_hw_metadata.c: In function ‘main’:
> > xdp_hw_metadata.c:763:45: error: ‘%d’ directive output may be truncated
> >writing between 1 and 10 bytes into a region of size 8 [-Werror=format-
> >truncation=]
> > 763 | snprintf(buf, sizeof(buf), "%d ", i);
> > | ^~
> > TEST-OBJ [test_progs] arg_parsing.test.o
> > xdp_hw_metadata.c:763:44: note: directive argument in the range [0,
> >2147483646]
> > 763 | snprintf(buf, sizeof(buf), "%d ", i);
> > | ^~~~~
> > xdp_hw_metadata.c:763:17: note: ‘snprintf’ output between 3 and 12 bytes into
> >a destination of size 8
> > 763 | snprintf(buf, sizeof(buf), "%d ", i);
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > xdp_hw_metadata.c:766:47: error: ‘%d’ directive output may be truncated
> >writing between 1 and 10 bytes into a region of size 6 [-Werror=format-
> >truncation=]
> > 766 | snprintf(buf, sizeof(buf), "1@%d ", i);
> > | ^~
> > xdp_hw_metadata.c:766:44: note: directive argument in the range [0,
> >2147483646]
> > 766 | snprintf(buf, sizeof(buf), "1@%d ", i);
> > | ^~~~~~~
> > xdp_hw_metadata.c:766:17: note: ‘snprintf’ output between 5 and 14 bytes into
> >a destination of size 8
> > 766 | snprintf(buf, sizeof(buf), "1@%d ", i);
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Thanks for pointing this out.
> Btw, do you know which build command will trigger these errors?
> I am using "make -C tools/testing/selftests/bpf" but cannot
> reproduce the build error.
>
> Thanks & Regards
> Siang
Last time I used the following to reproduce similar issues on my side:
make -C tools/testing/selftests TARGETS="bpf" LLVM=1 USERCFLAGS="-Wformat-truncation"
You can also try to use something like asprintf instead of managing the buffer
sizes manually.
Powered by blists - more mailing lists