Re: [PATCH bpf-next V3] bpf: use -Wno-address-of-packed-member in some selftests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2/6/24 2:23 AM, Jose E. Marchesi wrote:
[Differences from V2:
- Remove conditionals in the source files pragmas, as the
   pragma is supported by both GCC and clang.]

Both GCC and clang implement the -Wno-address-of-packed-member
warning, which is enabled by -Wall, that warns about taking the
address of a packed struct field when it can lead to an "unaligned"
address.

This triggers the following errors (-Werror) when building three
particular BPF selftests with GCC:

   progs/test_cls_redirect.c
   986 |         if (ipv4_is_fragment((void *)&encap->ip)) {
   progs/test_cls_redirect_dynptr.c
   410 |         pkt_ipv4_checksum((void *)&encap_gre->ip);
   progs/test_cls_redirect.c
   521 |         pkt_ipv4_checksum((void *)&encap_gre->ip);
   progs/test_tc_tunnel.c
    232 |         set_ipv4_csum((void *)&h_outer.ip);

These warnings do not signal any real problem in the tests as far as I
can see.

This patch adds pragmas to these test files that inhibit the
-Waddress-of-packed-member warning.

Tested in bpf-next master.
No regressions.

Signed-off-by: Jose E. Marchesi <jose.marchesi@xxxxxxxxxx>
Cc: Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx>
Cc: Yonghong Song <yhs@xxxxxxxx>
Cc: Eduard Zingerman <eddyz87@xxxxxxxxx>
Cc: David Faust <david.faust@xxxxxxxxxx>
Cc: Cupertino Miranda <cupertino.miranda@xxxxxxxxxx>

Acked-by: Yonghong Song <yonghong.song@xxxxxxxxx>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux