# RE: \[PATCH bpf-next v5 2/4\] selftests/bpf: Add launch time request to xdp\_hw\_metadata

- From: Song, Yoong Siang \<hidden\>
- Date: 2025-01-15 16:07:50 
- List: netdev
- Page: https://ratatoskr.run/netdev/2025/01/2891671
- Thread: https://ratatoskr.run/netdev/2025/01/2889672/t.md

```text
On Wednesday, January 15, 2025 10:57 PM, Daniel Borkmann [ref] 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
```
