diff options
author | Richard Yao <[email protected]> | 2022-11-03 12:58:14 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2022-11-03 09:58:14 -0700 |
commit | f47f6a055d0c282593fe701bcaa968225ba9d1fc (patch) | |
tree | 6d8e8a5322d8bab5416c1894577c457ae64534ae /cmd | |
parent | 27d29946be5e555d8659d6ebdeda6ae771ada5d6 (diff) |
Address warnings about possible division by zero from clangsa
* The complaint in ztest_replay_write() is only possible if something
went horribly wrong. An assertion will silence this and if it goes
off, we will know that something is wrong.
* The complaint in spa_estimate_metaslabs_to_flush() is not impossible,
but seems very unlikely. We resolve this by passing the value from
the `MIN()` that does not go to infinity when the variable is zero.
There was a third report from Clang's scan-build, but that was a
definite false positive and disappeared when checked again through
Clang's static analyzer with Z3 refution via CodeChecker.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #14124
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/ztest.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cmd/ztest.c b/cmd/ztest.c index 19edab4eb..1c7c74c5d 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -2177,6 +2177,7 @@ ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap) * but not always, because we also want to verify correct * behavior when the data was not recently read into cache. */ + ASSERT(doi.doi_data_block_size); ASSERT0(offset % doi.doi_data_block_size); if (ztest_random(4) != 0) { int prefetch = ztest_random(2) ? |