[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251204160615.3e89de15@pumpkin>
Date: Thu, 4 Dec 2025 16:06:15 +0000
From: David Laight <david.laight.linux@...il.com>
To: "Arnd Bergmann" <arnd@...db.de>
Cc: "Arnd Bergmann" <arnd@...nel.org>, "Theodore Ts'o" <tytso@....edu>,
"Andreas Dilger" <adilger.kernel@...ger.ca>, "Jan Kara" <jack@...e.cz>,
"Darrick J. Wong" <djwong@...nel.org>, linux-ext4@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ext4: fix ext4_tune_sb_params padding
On Thu, 04 Dec 2025 14:42:06 +0100
"Arnd Bergmann" <arnd@...db.de> wrote:
> On Thu, Dec 4, 2025, at 13:35, David Laight wrote:
> > On Thu, 4 Dec 2025 11:19:10 +0100
> > Arnd Bergmann <arnd@...nel.org> wrote:
> >
> >> From: Arnd Bergmann <arnd@...db.de>
> >>
> >> The padding at the end of struct ext4_tune_sb_params is architecture
> >> specific and in particular is different between x86-32 and x86-64,
> >> since the __u64 member only enforces struct alignment on the latter.
> >
> > Is it worth adding a compile-time check for the size somewhere?
> > Since the intention seems to be that any extensions will use the padding.
>
> There is already ABI checking with abigail that ensures that struct
> members and sizes don't change in the future, which I think covers
> that. I would also like to push my series to enable -Werror=padded
> in the header checks, but I'm not sure yet what others think of the
> idea.
Putting it in the command line is going to be griefsome (at least in the
short term) even for uapi headers - where you really don't want padding.
(Tell that to some of the standards bodies...)
It is a shame there isn't an attribute, but you can wrap definitions:
#define check_padding(...) _Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic error \"-Wpadded\""); \
__VA_ARGS__ \
_Pragma("GCC diagnostic pop");
check_padding(
typedef struct fubar {
int a;
char b;
} fred;
) /* check_padding */
I've thought about doing something similar to avoid the 'type-limits' check
inside statically_true() and the like for W=1 builds.
David
Powered by blists - more mailing lists