Skip to content

Commit d591c94

Browse files
markjdbtonyhutter
authored andcommitted
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. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Mark Johnston <[email protected]> Closes #12383
1 parent fa514db commit d591c94

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

module/zfs/dnode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ dnode_cons(void *arg, void *unused, int kmflag)
129129
zfs_refcount_create(&dn->dn_tx_holds);
130130
list_link_init(&dn->dn_link);
131131

132+
bzero(&dn->dn_next_type[0], sizeof (dn->dn_next_type));
132133
bzero(&dn->dn_next_nblkptr[0], sizeof (dn->dn_next_nblkptr));
133134
bzero(&dn->dn_next_nlevels[0], sizeof (dn->dn_next_nlevels));
134135
bzero(&dn->dn_next_indblkshift[0], sizeof (dn->dn_next_indblkshift));

0 commit comments

Comments
 (0)