NTFS3 file system kernel mode driver
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Arnd Bergmann <arnd@kernel.org>,
	Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ntfs3: align struct ATTR_LIST_ENTRY
Date: Thu, 7 Dec 2023 16:37:26 -0800	[thread overview]
Message-ID: <926cddcc-2604-4d88-b9c9-91ad1d148c6c@infradead.org> (raw)
In-Reply-To: <20231207142838.960725-1-arnd@kernel.org>



On 12/7/23 06:28, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> On architectures like i386 that don't enforce natural alignment of u64
> struct members, so the recent change to remove the final 48 bits
> reduced the structure size from 32 to 28 bytes:
> 
> include/linux/build_bug.h:78:41: error: static assertion failed: "sizeof(struct ATTR_LIST_ENTRY) == 0x20"
> fs/ntfs3/ntfs.h:530:1: note: in expansion of macro 'static_assert'
>   530 | static_assert(sizeof(struct ATTR_LIST_ENTRY) == 0x20);
>       | ^~~~~~~~~~~~~
> 
> Add an alignment attribute that makes the structure the same across
> all architectures again.
> 
> Fixes: d155617006eb ("fs/ntfs3: Fix detected field-spanning write (size 8) of single field "le->name"")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>


Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

> ---
>  fs/ntfs3/ntfs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h
> index c8981429c721..2d409ac94cbb 100644
> --- a/fs/ntfs3/ntfs.h
> +++ b/fs/ntfs3/ntfs.h
> @@ -525,7 +525,7 @@ struct ATTR_LIST_ENTRY {
>  	__le16 id;		// 0x18: struct ATTRIB ID.
>  	__le16 name[];		// 0x1A: To get real name use name_off.
>  
> -}; // sizeof(0x20)
> +} __aligned((8)); // sizeof(0x20)
>  
>  static_assert(sizeof(struct ATTR_LIST_ENTRY) == 0x20);
>  

-- 
~Randy

      reply	other threads:[~2023-12-08  0:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 14:28 [PATCH] ntfs3: align struct ATTR_LIST_ENTRY Arnd Bergmann
2023-12-08  0:37 ` Randy Dunlap [this message]

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=926cddcc-2604-4d88-b9c9-91ad1d148c6c@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).