]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Silence potential divide by zero warning in qpmulti.c
authorMark Andrews <marka@isc.org>
Fri, 30 May 2025 00:51:21 +0000 (10:51 +1000)
committerMark Andrews <marka@isc.org>
Mon, 2 Jun 2025 23:41:21 +0000 (23:41 +0000)
Coverity flagged a potential divide by zero error in collect in
qpmulti.c when the elapsed time is zero but that is only called
once the elapsed time is greater than or equal to RUNTIME (1/4
second) so INSIST this is the case.

(cherry picked from commit 081dbb110834dc76ae8978a6dd85097382c8e364)

tests/bench/qpmulti.c

index f9e7946084616743de92872b219d883ad39a61c9..b8451a4fb5377449c48a6b46ee9269f48eda5590 100644 (file)
@@ -771,6 +771,8 @@ collect(void *varg) {
                stats[mut].compactions += tp->compactions;
        }
 
+       INSIST(elapsed >= RUNTIME);
+
        printf("%7.3f\t", RUNTIME / (double)NS_PER_SEC);
        printf("%7.3f\t", elapsed / (double)NS_PER_SEC);
        printf("%7.3f\t", load_time);