HomeFreeBSD

zdb: Silence Coverity complaint about verify_livelist_allocs()

Description

zdb: Silence Coverity complaint about verify_livelist_allocs()

svb is declared on the stack. We then set parts of svb.svb_dva with
DVA_SET_VDEV(), DVA_SET_OFFSET() and DVA_SET_ASIZE(). However, the DVA
contains other fields for pad, GRID and G. When setting the fields we
use, we technically read uninitialized bits from the fields we do not
use. This makes Coverity and Clang's Static Analyzer complain.
Presumably, other static analyzers might complain too.

There is no real bug here, but we are still technically reading
undefined data and unless we stop doing that, static analyzers will
complain about it in perpetuum and this could obscure real issues. We
silence the static analyzer complaints by using a 0 struct initializer.

Reported by: Coverity (CID 1524627)
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14210

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Nov 16 2022, 9:23 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Nov 29 2022, 6:00 PM
Parents
rG8532da5e20b9: Cleanup: Delete dead code from send_merge_thread()
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG887fb3784388: zdb: Silence Coverity complaint about verify_livelist_allocs() (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Nov 29 2022, 6:00 PM