]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
xfs: zero entire directory data block header region at init
authorYuto Ohnuki <ytohnuki@amazon.com>
Sat, 11 Apr 2026 14:24:13 +0000 (15:24 +0100)
committerCarlos Maiolino <cem@kernel.org>
Mon, 27 Apr 2026 08:36:36 +0000 (10:36 +0200)
commit00dd8d7ec5253c6273023a0fd6dc08683e0bdfef
treef2dffa109004e4e7ff87a275f4de8feea530406a
parentbfb4dc533d0abaca07013dd71e6b5c6f182232b3
xfs: zero entire directory data block header region at init

xfs_dir3_data_init currently zeroes only the xfs_dir3_blk_hdr portion of
the directory data block header, then manually initializes the bestfree
entries in a loop. This leaves the pad field in xfs_dir3_data_hdr
uninitialized and requires explicit zeroing of each bestfree slot.

Zero the entire header region (geo->data_entry_offset bytes)
unconditionally before setting individual fields. This covers all
current and future header fields, all padding (implicit and explicit),
and the bestfree array, so the manual zeroing loop for bestfree can be
removed.

Suggested-by: Dave Chinner <dgc@kernel.org>
Signed-off-by: Yuto Ohnuki <ytohnuki@amazon.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/libxfs/xfs_dir2_data.c