Skip to content

Commit 8aec9db

Browse files
GustavoARSilvakdave
authored andcommitted
btrfs: send: fix -Wflex-array-member-not-at-end warning in struct send_ctx
The warning -Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. 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] and move the declaration of send_ctx::cur_inode_path to the end. Notice that struct fs_path contains a flexible array member inline_buf, but also a padding array and a limit calculated for the usable space of inline_buf (FS_PATH_INLINE_SIZE). It is not the pattern where flexible array is in the middle of a structure and could potentially overwrite other members. Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent e92c294 commit 8aec9db

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/btrfs/send.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ struct send_ctx {
178178
u64 cur_inode_rdev;
179179
u64 cur_inode_last_extent;
180180
u64 cur_inode_next_write_offset;
181-
struct fs_path cur_inode_path;
182181
bool cur_inode_new;
183182
bool cur_inode_new_gen;
184183
bool cur_inode_deleted;
@@ -305,6 +304,9 @@ struct send_ctx {
305304

306305
struct btrfs_lru_cache dir_created_cache;
307306
struct btrfs_lru_cache dir_utimes_cache;
307+
308+
/* Must be last as it ends in a flexible-array member. */
309+
struct fs_path cur_inode_path;
308310
};
309311

310312
struct pending_dir_move {

0 commit comments

Comments
 (0)