]> git.proxmox.com Git - mirror_zfs.git/commit
Initialize "autoreplace" in spa_ld_get_props()
authorMark Johnston <markj@FreeBSD.org>
Fri, 16 Jul 2021 13:19:59 +0000 (09:19 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 26 Jul 2021 18:53:47 +0000 (11:53 -0700)
commitda27b8bc7f2778b28fa73547ff91bb8cc962fc0e
treee2ad046d67aad0f57d8ad298f7ebf16aa51c0ae9
parent1c24bf966c373009f2be77438e8696aabf50a7e7
Initialize "autoreplace" in spa_ld_get_props()

spa_prop_find() may fail to find the specified property, in which case
it suppresses ENOENT from zap_lookup().  In this case, the return value
is left uninitialized, so spa_autoreplace was being initialized using an
uninitialized stack variable.

This was found using KMSAN.  It appears to be a regression from commit
9eb7b46ed0, which removed the initialization of "autoreplace" from the
definition.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #12383
module/zfs/spa.c