mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 19:34:43 +01:00
Fix uninitialized variable warning in vdev_prop_get()
Update vdev_prop_get_objid() to set objid on error as the comment
in vdev_prop_get() describes.
"objid is set to 0 when absent and the few cases that call
zap_lookup directly guard against this below."
This resolves the following possible uninitialized variable warning.
module/zfs/vdev.c: In function ‘vdev_prop_get’:
module/zfs/vdev.c:6913:12: error: ‘objid’ may be used uninitialized
in this function [-Werror=maybe-uninitialized]
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #18616
This commit is contained in:
1 parent
0aa4088dce
commit
e199f6d98b
1 file changed
+2
-1
+2
-1
@@ -460,6 +460,7 @@ vdev_prop_get_objid(vdev_t *vd, uint64_t *objid)
|
||||
} else if (vd->vdev_leaf_zap != 0) {
|
||||
*objid = vd->vdev_leaf_zap;
|
||||
} else {
|
||||
*objid = 0;
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
@@ -6444,7 +6445,7 @@ vdev_prop_get(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl)
|
||||
spa_t *spa = vd->vdev_spa;
|
||||
objset_t *mos = spa->spa_meta_objset;
|
||||
int err = 0;
|
||||
uint64_t objid;
|
||||
uint64_t objid = 0;
|
||||
uint64_t vdev_guid;
|
||||
nvpair_t *elem = NULL;
|
||||
nvlist_t *nvprops = NULL;
|
||||
|
||||
Reference in new issue
Block a user