BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: "Jose E. Marchesi" <jose.marchesi@oracle.com>, bpf@vger.kernel.org
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	Yonghong Song <yhs@meta.com>,
	Eduard Zingerman <eddyz87@gmail.com>,
	David Faust <david.faust@oracle.com>,
	Cupertino Miranda <cupertino.miranda@oracle.com>
Subject: Re: [PATCH bpf-next V3] bpf: use -Wno-address-of-packed-member in some selftests
Date: Tue, 6 Feb 2024 08:15:36 -0800	[thread overview]
Message-ID: <6fb7e648-4eef-418f-b156-5bce5d3bbb32@linux.dev> (raw)
In-Reply-To: <20240206102330.7113-1-jose.marchesi@oracle.com>


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@oracle.com>
> Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
> Cc: Yonghong Song <yhs@meta.com>
> Cc: Eduard Zingerman <eddyz87@gmail.com>
> Cc: David Faust <david.faust@oracle.com>
> Cc: Cupertino Miranda <cupertino.miranda@oracle.com>

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


  reply	other threads:[~2024-02-06 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 10:23 [PATCH bpf-next V3] bpf: use -Wno-address-of-packed-member in some selftests Jose E. Marchesi
2024-02-06 16:15 ` Yonghong Song [this message]
2024-02-06 17:50 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6fb7e648-4eef-418f-b156-5bce5d3bbb32@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=cupertino.miranda@oracle.com \
    --cc=david.faust@oracle.com \
    --cc=eddyz87@gmail.com \
    --cc=jose.marchesi@oracle.com \
    --cc=yhs@meta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox