mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Arnd Bergmann <arnd@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Leon Hwang <leon.hwang@linux.dev>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	KP Singh <kpsingh@kernel.org>,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bpf: avoid padding in struct bpf_common_attr
Date: Tue, 19 May 2026 15:17:59 -0700	[thread overview]
Message-ID: <9eecfab7-afac-4144-b544-ac715b07980e@linux.dev> (raw)
In-Reply-To: <20260519203858.1342507-1-arnd@kernel.org>



On 5/19/26 1:38 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Building linux/bpf.h with -Wpadded shows an unintentionally
> added portion of padding because of the 64-bit alignment:
>
> ./usr/include/linux/bpf.h:1510:1: error: padding struct size to alignment boundary with 4 bytes [-Werror=padded]
>
> Avoid this by adding explicit padding.
>
> Fixes: f28771c0691b ("bpf: Extend BPF syscall with common attributes support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   include/uapi/linux/bpf.h | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index cc4c0b62cdfa..0f0ec00cae4a 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -1507,6 +1507,7 @@ struct bpf_common_attr {
>   	__u32 log_size;
>   	__u32 log_level;
>   	__u32 log_true_size;
> +	__u32 __pad;

Let us make it as
	__u32 :32;
?

This can avoid people to use the '__pad' name.
IIUC, typically uapi struct won't have implicit padding.

>   };
>   
>   #define BPF_OBJ_NAME_LEN 16U


  parent reply	other threads:[~2026-05-19 22:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 20:38 Arnd Bergmann
2026-05-19 20:52 ` Song Liu
2026-05-20  7:51   ` Geert Uytterhoeven
2026-05-19 21:17 ` bot+bpf-ci
2026-05-19 22:17 ` Yonghong Song [this message]
2026-05-20  6:36   ` Arnd Bergmann
2026-05-20 14:03     ` Alexei Starovoitov
2026-05-20 14:22       ` Geert Uytterhoeven

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=9eecfab7-afac-4144-b544-ac715b07980e@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=andrii@kernel.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=leon.hwang@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=song@kernel.org \
    /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

all inboxes | Powered by JetHome®