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
This commit is contained in:
parent
8532da5e20
commit
887fb37843
|
@ -468,7 +468,7 @@ static void
|
||||||
verify_livelist_allocs(metaslab_verify_t *mv, uint64_t txg,
|
verify_livelist_allocs(metaslab_verify_t *mv, uint64_t txg,
|
||||||
uint64_t offset, uint64_t size)
|
uint64_t offset, uint64_t size)
|
||||||
{
|
{
|
||||||
sublivelist_verify_block_t svb;
|
sublivelist_verify_block_t svb = {{{0}}};
|
||||||
DVA_SET_VDEV(&svb.svb_dva, mv->mv_vdid);
|
DVA_SET_VDEV(&svb.svb_dva, mv->mv_vdid);
|
||||||
DVA_SET_OFFSET(&svb.svb_dva, offset);
|
DVA_SET_OFFSET(&svb.svb_dva, offset);
|
||||||
DVA_SET_ASIZE(&svb.svb_dva, size);
|
DVA_SET_ASIZE(&svb.svb_dva, size);
|
||||||
|
|
Loading…
Reference in New Issue