summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_ondisk.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-10-20 16:17:41 -0700
committerDarrick J. Wong <djwong@kernel.org>2022-10-31 08:58:19 -0700
commita38ebce1da271f480e47c3def4f810c6106b74a1 (patch)
tree9207f5c9adca79346bc6102693bfc0856adef0cb /fs/xfs/xfs_ondisk.h
parent59da7ff49d67a1b63b1b81c7f53dcb6a84cdad2b (diff)
downloadlwn-a38ebce1da271f480e47c3def4f810c6106b74a1.tar.gz
lwn-a38ebce1da271f480e47c3def4f810c6106b74a1.zip
xfs: fix memcpy fortify errors in BUI log format copying
Starting in 6.1, CONFIG_FORTIFY_SOURCE checks the length parameter of memcpy. Unfortunately, it doesn't handle flex arrays correctly: ------------[ cut here ]------------ memcpy: detected field-spanning write (size 48) of single field "dst_bui_fmt" at fs/xfs/xfs_bmap_item.c:628 (size 16) Fix this by refactoring the xfs_bui_copy_format function to handle the copying of the head and the flex array members separately. While we're at it, fix a minor validation deficiency in the recovery function. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_ondisk.h')
-rw-r--r--fs/xfs/xfs_ondisk.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/xfs/xfs_ondisk.h b/fs/xfs/xfs_ondisk.h
index 758702b9495f..56917e236370 100644
--- a/fs/xfs/xfs_ondisk.h
+++ b/fs/xfs/xfs_ondisk.h
@@ -134,6 +134,11 @@ xfs_check_ondisk_structs(void)
XFS_CHECK_STRUCT_SIZE(struct xfs_trans_header, 16);
XFS_CHECK_STRUCT_SIZE(struct xfs_attri_log_format, 40);
XFS_CHECK_STRUCT_SIZE(struct xfs_attrd_log_format, 16);
+ XFS_CHECK_STRUCT_SIZE(struct xfs_bui_log_format, 16);
+ XFS_CHECK_STRUCT_SIZE(struct xfs_bud_log_format, 16);
+ XFS_CHECK_STRUCT_SIZE(struct xfs_map_extent, 32);
+
+ XFS_CHECK_OFFSET(struct xfs_bui_log_format, bui_extents, 16);
/*
* The v5 superblock format extended several v4 header structures with