From f75b9094df9e924f617003a9ef1398a2e5d59f8b Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Fri, 16 Jul 2021 10:12:47 -0400 Subject: [PATCH] Initialize dn_next_type[] in the dnode constructor It seems nothing ensures that this array is zeroed when a dnode is freshly allocated, so in principle it retains the values from the previous allocation. In practice it seems to be the case that the fields should end up zeroed, but we can zero the field anyway for consistency. This was found using KMSAN. Signed-off-by: Mark Johnston --- module/zfs/dnode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index b1813a8951d5..7f741542ce02 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -129,6 +129,7 @@ dnode_cons(void *arg, void *unused, int kmflag) zfs_refcount_create(&dn->dn_tx_holds); list_link_init(&dn->dn_link); + bzero(&dn->dn_next_type[0], sizeof (dn->dn_next_type)); bzero(&dn->dn_next_nblkptr[0], sizeof (dn->dn_next_nblkptr)); bzero(&dn->dn_next_nlevels[0], sizeof (dn->dn_next_nlevels)); bzero(&dn->dn_next_indblkshift[0], sizeof (dn->dn_next_indblkshift));