HomeFreeBSD

Fix theoretical use of uninitialized values

Description

Fix theoretical use of uninitialized values

Clang's static analyzer complains about this.

In get_configs(), if we have an invalid configuration that has no top
level vdevs, we can read a couple of uninitialized variables. Aborting
upon seeing this would break the userland tools for healthy pools, so we
instead initialize the two variables to 0 to allow the userland tools to
continue functioning for the pools with valid configurations.

In zfs_do_wait(), if no wait activities are enabled, we read an
uninitialized error variable.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14043

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Oct 15 2022, 10:27 PM
Tony Hutter <hutter2@llnl.gov>Committed on Dec 1 2022, 8:39 PM
Parents
rG3830858c5cb4: Fix memory leaks in dmu_send()/dmu_send_obj()
Branches
Unknown
Tags
Unknown

Event Timeline

Tony Hutter <hutter2@llnl.gov> committed rG4c59fde1f595: Fix theoretical use of uninitialized values (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Dec 1 2022, 8:39 PM