lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251003143502.GJ4052@suse.cz>
Date: Fri, 3 Oct 2025 16:35:02 +0200
From: David Sterba <dsterba@...e.cz>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Chris Mason <clm@...com>, David Sterba <dsterba@...e.com>,
	linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] btrfs: Avoid -Wflex-array-member-not-at-end warning

On Fri, Oct 03, 2025 at 03:11:06PM +0100, Gustavo A. R. Silva wrote:
> -Wflex-array-member-not-at-end was introduced in GCC-14, and we are
> getting ready to enable it, globally.
> 
> Move the conflicting declaration to the end of the corresponding
> structure. Notice that `struct fs_path` is a flexible structure,
> this is a structure that contains a flexible-array member (`char
> inline_buf[];` in this case).

It contains a flexible member but also a padding array and a limit
calculated for the usable space of inline_buf (FS_PATH_INLINE_SIZE),
it's not the pattern where flexible array is in the middle of a
structure and could potentially overwrite other members.

> Fix the following warning:
> 
> fs/btrfs/send.c:181:24: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Otheriwse OK to fix the warning.

> Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
> ---
>  fs/btrfs/send.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index 9230e5066fc6..2b7cf49a35bb 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -178,7 +178,6 @@ struct send_ctx {
>  	u64 cur_inode_rdev;
>  	u64 cur_inode_last_extent;
>  	u64 cur_inode_next_write_offset;
> -	struct fs_path cur_inode_path;
>  	bool cur_inode_new;
>  	bool cur_inode_new_gen;
>  	bool cur_inode_deleted;
> @@ -305,6 +304,9 @@ struct send_ctx {
>  
>  	struct btrfs_lru_cache dir_created_cache;
>  	struct btrfs_lru_cache dir_utimes_cache;
> +
> +	/* Must be last --ends in a flexible-array member. */
                        ^^

Is this an en dash?

> +	struct fs_path cur_inode_path;
>  };
>  
>  struct pending_dir_move {
> -- 
> 2.43.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ