git: f29bdea04776 - main - ext4_ext_tree_init: correct memset initialization

From: Ryan Libby <rlibby_at_FreeBSD.org>
Date: Tue, 25 Jun 2024 17:42:40 UTC
The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=f29bdea0477625cb3b9de2971e92b67e5bb71178

commit f29bdea0477625cb3b9de2971e92b67e5bb71178
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-06-25 17:41:11 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-06-25 17:41:11 +0000

    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));