summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-07-16 10:12:47 -0400
committerTony Hutter <hutter2@llnl.gov>2021-08-31 12:16:23 -0700
commitd591c944240d7c2943f808670a912647ce5c97d6 (patch)
treed24f00a814b630f14e397af96d980eb258a45321
parentfa514dbb109f8c82f43156b4559aede80ade8610 (diff)
Initialize dn_next_type[] in the dnode constructorzfs-2.0.6-staging
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 <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Mark Johnston <markj@FreeBSD.org> Closes #12383
-rw-r--r--module/zfs/dnode.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c
index 23364dbae..5ad5be328 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));