Fix uninitialized value read in vdev_prop_set()

If no errors are encountered, we read an uninitialized error value.

Clang's static analyzer complained about this.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14007
This commit is contained in:
Richard Yao 2022-10-11 15:24:36 -04:00 committed by GitHub
parent e5646c5e37
commit 70248b82e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5648,7 +5648,7 @@ vdev_prop_set(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl)
nvpair_t *elem = NULL;
uint64_t vdev_guid;
nvlist_t *nvprops;
int error;
int error = 0;
ASSERT(vd != NULL);