public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: "Arnd Bergmann" <arnd@arndb.de>
Cc: "Arnd Bergmann" <arnd@kernel.org>,
	"Theodore Ts'o" <tytso@mit.edu>,
	"Andreas Dilger" <adilger.kernel@dilger.ca>,
	"Jan Kara" <jack@suse.cz>, "Darrick J. Wong" <djwong@kernel.org>,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ext4: fix ext4_tune_sb_params padding
Date: Thu, 4 Dec 2025 16:06:15 +0000	[thread overview]
Message-ID: <20251204160615.3e89de15@pumpkin> (raw)
In-Reply-To: <6893f1e7-3e0b-4cf1-9c35-5d28b2507129@app.fastmail.com>

On Thu, 04 Dec 2025 14:42:06 +0100
"Arnd Bergmann" <arnd@arndb.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@kernel.org> wrote:
> >  
> >> From: Arnd Bergmann <arnd@arndb.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

  reply	other threads:[~2025-12-04 16:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04 10:19 [PATCH] ext4: fix ext4_tune_sb_params padding Arnd Bergmann
2025-12-04 10:31 ` Jan Kara
2025-12-05 10:17   ` Andreas Dilger
2025-12-05 11:22     ` Arnd Bergmann
2025-12-19  8:43       ` Geert Uytterhoeven
2025-12-04 12:35 ` David Laight
2025-12-04 13:42   ` Arnd Bergmann
2025-12-04 16:06     ` David Laight [this message]
2026-01-15 15:37 ` Theodore Ts'o

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=20251204160615.3e89de15@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=djwong@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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