[Git][NTPsec/ntpsec][master] 2 commits: Coverity: add parens in ntp_filegen.c to maybe help
Hal Murray (@hal.murray)
gitlab at mg.gitlab.com
Sun Jan 19 20:52:14 UTC 2025
Hal Murray pushed to branch master at NTPsec / ntpsec
Commits:
a8ec4960 by Hal Murray at 2025-01-19T12:48:40-08:00
Coverity: add parens in ntp_filegen.c to maybe help
Looks like a bug in Coverity is generating a false positive
- - - - -
ab012017 by Hal Murray at 2025-01-19T12:50:02-08:00
Coverity: fix bug in ntpd/ntp_filegen.c
time_t vs 32 bit uptime_t/current_time
- - - - -
2 changed files:
- ntpd/ntp_filegen.c
- ntpd/ntp_refclock.c
Changes:
=====================================
ntpd/ntp_filegen.c
=====================================
@@ -345,7 +345,8 @@ filegen_setup(
case FILEGEN_AGE:
/* current_time doesn't go backwards
* so don't need to check id_lo */
- current = ((unsigned)gen->id_hi > current_time);
+ /* Coverity: id_hi is time_t, current_time is 32 bits */
+ current = (gen->id_hi > (time_t)current_time);
break;
case FILEGEN_DAY:
=====================================
ntpd/ntp_refclock.c
=====================================
@@ -469,7 +469,7 @@ refclock_sample(
* approximately 60 percent of the samples remain.
*/
i = 0; j = n;
- m = n - (n * 4) / 10;
+ m = n - ((n*4)/10);
while ((j - i) > m) {
offset = off[(j + i) / 2];
if (off[j - 1] - offset < offset - off[i])
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/f928b8bd94e06dc0a9d10a9ef7dbe809d2e711a8...ab0120171c502b827215eaa2bb76fa95b8153d82
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/f928b8bd94e06dc0a9d10a9ef7dbe809d2e711a8...ab0120171c502b827215eaa2bb76fa95b8153d82
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/20250119/bf16255f/attachment-0001.htm>
More information about the vc
mailing list