Re: [PATCH bpf-next V2] bpf: use -Wno-address-of-packed-member when building with GCC

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

 



On Wed, 2024-01-31 at 10:44 +0100, Jose E. Marchesi wrote:
> [Differences from V1:
> - Now pragmas are used in testfiles instead of flags
>   in Makefile.]
> 
> GCC implements 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.  Clang
> doesn't support this warning.
> 
> 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 if the compiler is not Clang.
> 
> 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: Eduard Zingerman <eddyz87@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