diff options
author | Mark Johnston <[email protected]> | 2021-07-16 09:19:59 -0400 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2021-09-14 12:41:10 -0700 |
commit | fceda40c1e66f44f50ef92e006ca4858f5d4ff98 (patch) | |
tree | 3bd6d766f5bc1b15f322f14b6e9fe52ed704a6ec | |
parent | 4434baab1101a63f64c21eceb7e662dededb31a7 (diff) |
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 <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Mark Johnston <[email protected]>
Closes #12383
-rw-r--r-- | module/zfs/spa.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 2a4db7d56..8ca9b49ba 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -4183,7 +4183,7 @@ spa_ld_get_props(spa_t *spa) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); if (error == 0) { - uint64_t autoreplace; + uint64_t autoreplace = 0; spa_prop_find(spa, ZPOOL_PROP_BOOTFS, &spa->spa_bootfs); spa_prop_find(spa, ZPOOL_PROP_AUTOREPLACE, &autoreplace); |