]> 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:07:31 +0000 (23:07 +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.

tests/bench/qpmulti.c

index 07c151e6c6fb0725a3cc0146d1735263fe16b82c..248b740df47fae111de40b4f84ab8206c8cac821 100644 (file)
@@ -756,6 +756,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);