Skip to content

Commit f6250e2

Browse files
author
Darrick J. Wong
committed
xfs: convert flex-array declarations in xfs attr shortform objects
As of 6.5-rc1, UBSAN trips over the ondisk extended attribute shortform definitions using an array length of 1 to pretend to be a flex array. Kernel compilers have to support unbounded array declarations, so let's correct this. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Kees Cook <keescook@chromium.org>
1 parent a49bbce commit f6250e2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

fs/xfs/libxfs/xfs_da_format.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ struct xfs_attr_shortform {
591591
uint8_t valuelen; /* actual length of value (no NULL) */
592592
uint8_t flags; /* flags bits (see xfs_attr_leaf.h) */
593593
uint8_t nameval[]; /* name & value bytes concatenated */
594-
} list[1]; /* variable sized array */
594+
} list[]; /* variable sized array */
595595
};
596596

597597
typedef struct xfs_attr_leaf_map { /* RLE map of free bytes */

fs/xfs/xfs_ondisk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ xfs_check_ondisk_structs(void)
8989
XFS_CHECK_OFFSET(xfs_attr_leaf_name_remote_t, namelen, 8);
9090
XFS_CHECK_OFFSET(xfs_attr_leaf_name_remote_t, name, 9);
9191
XFS_CHECK_STRUCT_SIZE(xfs_attr_leafblock_t, 32);
92+
XFS_CHECK_STRUCT_SIZE(struct xfs_attr_shortform, 4);
9293
XFS_CHECK_OFFSET(struct xfs_attr_shortform, hdr.totsize, 0);
9394
XFS_CHECK_OFFSET(struct xfs_attr_shortform, hdr.count, 2);
9495
XFS_CHECK_OFFSET(struct xfs_attr_shortform, list[0].namelen, 4);

0 commit comments

Comments
 (0)