[Git][NTPsec/ntpsec][master] Undo previous Covarity attempt

Hal Murray (@hal.murray) gitlab at mg.gitlab.com
Fri Jan 24 10:27:29 UTC 2025



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
9863dd93 by Hal Murray at 2025-01-24T02:25:44-08:00
Undo previous Covarity attempt
Covarity found a real bug in the new code.
It rounds down where we needed to round up.

- - - - -


1 changed file:

- ntpd/ntp_refclock.c


Changes:

=====================================
ntpd/ntp_refclock.c
=====================================
@@ -469,7 +469,8 @@ refclock_sample(
 	 * approximately 60 percent of the samples remain.
 	 */
 	i = 0; j = n;
-	m = n*6/10;
+	/* m=n*6/10 doesn't work.  It rounds down.  We need up. */
+	m = n-(n*4/10);
 	/* CID 497295, Bug in Coverity: goes around loop when it shouldn't */
 	/* coverity[INTEGER_OVERFLOW] */
 	while ((j - i) > m) {



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/9863dd93c6e9ebce675282b0387300101101feba

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/9863dd93c6e9ebce675282b0387300101101feba
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20250124/5f897e77/attachment-0001.htm>


More information about the vc mailing list