From 64fcbdc15e2ba52311fb313b28ec50629680d94e Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 5 Mar 2026 15:39:10 -0800 Subject: [PATCH] Zero out dirent padding to avoid leaking to disk. This allocation here currently leaks through __pad[7] which is written to disk. Use the initializer to enforce zeroing the pad. The name member is written right after. Signed-off-by: Auke Kok --- kmod/src/dir.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kmod/src/dir.c b/kmod/src/dir.c index d2343e58..efcdef24 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -587,10 +587,12 @@ static int add_entry_items(struct super_block *sb, u64 dir_ino, u64 hash, } /* initialize the dent */ - dent->ino = cpu_to_le64(ino); - dent->hash = cpu_to_le64(hash); - dent->pos = cpu_to_le64(pos); - dent->type = mode_to_type(mode); + *dent = (struct scoutfs_dirent) { + .ino = cpu_to_le64(ino), + .hash = cpu_to_le64(hash), + .pos = cpu_to_le64(pos), + .type = mode_to_type(mode), + }; memcpy(dent->name, name, name_len); init_dirent_key(&ent_key, SCOUTFS_DIRENT_TYPE, dir_ino, hash, pos);