From f29bdea0477625cb3b9de2971e92b67e5bb71178 Mon Sep 17 00:00:00 2001 From: Ryan Libby Date: Tue, 25 Jun 2024 10:41:11 -0700 Subject: [PATCH] ext4_ext_tree_init: correct memset initialization gcc -Wmemset-elt-size diagnosed this. The code was only initializing 1/4 of the array. However, it was actually harmless, as the only caller had done an M_ZERO allocation anyway. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45701 --- sys/fs/ext2fs/ext2_extents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/ext2fs/ext2_extents.c b/sys/fs/ext2fs/ext2_extents.c index 3ae1da4fe6b7..146aa48f6743 100644 --- a/sys/fs/ext2fs/ext2_extents.c +++ b/sys/fs/ext2fs/ext2_extents.c @@ -711,7 +711,7 @@ ext4_ext_tree_init(struct inode *ip) ip->i_flag |= IN_E4EXTENTS; - memset(ip->i_data, 0, EXT2_NDADDR + EXT2_NIADDR); + memset(ip->i_data, 0, sizeof(ip->i_data)); ehp = (struct ext4_extent_header *)ip->i_data; ehp->eh_magic = htole16(EXT4_EXT_MAGIC); ehp->eh_max = htole16(ext4_ext_space_root(ip));