diff options
author | Richard Yao <[email protected]> | 2022-11-16 16:23:53 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-11-29 10:00:45 -0800 |
commit | 887fb37843887f79582003f55b314530b870643a (patch) | |
tree | dcf9f7f47ad02d9220dffe509d97b82f239544b2 | |
parent | 8532da5e20b90bed8decd22726a70c7c81ef6951 (diff) |
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 <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #14210
-rw-r--r-- | cmd/zdb/zdb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index d19eb71f0..8b5e5a4ed 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -468,7 +468,7 @@ static void verify_livelist_allocs(metaslab_verify_t *mv, uint64_t txg, 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_OFFSET(&svb.svb_dva, offset); DVA_SET_ASIZE(&svb.svb_dva, size); |