[ntpsec-main commit] More Coverity cleanup. No logic changes.
Eric S. Raymond
esr at ntpsec.org
Wed Nov 4 10:43:47 UTC 2015
Module: ntpsec-main
Branch: master
Commit: b1fa16c584575af132b96f3a2a8a5bbf54ae4dd5
Changeset: http://git.ntpsec.org//commit/?id=b1fa16c584575af132b96f3a2a8a5bbf54ae4dd5
Author: Eric S. Raymond <esr at thyrsus.com>
Date: Wed Nov 4 05:43:10 2015 -0500
More Coverity cleanup. No logic changes.
---
libisc/log.c | 2 +-
libntp/recvbuff.c | 1 +
libparse/clk_trimtsip.c | 1 +
ntpd/ntpd.c | 2 ++
ntpd/refclock_mx4200.c | 1 +
ntpd/refclock_parse.c | 10 +++++-----
ntpfrob/pps-api.c | 2 +-
7 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/libisc/log.c b/libisc/log.c
index c43c2ab..c054412 100644
--- a/libisc/log.c
+++ b/libisc/log.c
@@ -1263,7 +1263,7 @@ isc_log_open(isc_logchannel_t *channel) {
* version renamed, and only if the base file exists
* and either has no size limit or has reached its size limit.
*/
- /* coverity[toctou] */
+ /* coverity[fs_check_call] */
if (stat(path, &statbuf) == 0) {
regular_file = S_ISREG(statbuf.st_mode) ? true : false;
/* XXXDCL if not regular_file complain? */
diff --git a/libntp/recvbuff.c b/libntp/recvbuff.c
index 3885141..8d601fc 100644
--- a/libntp/recvbuff.c
+++ b/libntp/recvbuff.c
@@ -101,6 +101,7 @@ create_buffers(int nbufs)
total_recvbufs++;
}
lowater_adds++;
+ /* coverity[leaked_storage] */
}
void
diff --git a/libparse/clk_trimtsip.c b/libparse/clk_trimtsip.c
index fc83b9f..99b871d 100644
--- a/libparse/clk_trimtsip.c
+++ b/libparse/clk_trimtsip.c
@@ -321,6 +321,7 @@ cvt_trimtsip(
t->t_dayleap = (u_short) getshort((unsigned char *)&mb(22)); /* day in week of leap correction */
t->t_week = (u_short) getshort((unsigned char *)&mb(18)); /* current week no */
if (t->t_week < GPSWRAP)
+ /* coverity[copy_paste_error] */
t->t_week = (u_short)(t->t_weekleap + GPSWEEKS);
lbp = (unsigned char *)&mb(14); /* last update time */
diff --git a/ntpd/ntpd.c b/ntpd/ntpd.c
index 8d1e881..0c45336 100644
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -326,7 +326,9 @@ parse_cmdline_opts(
case 'u':
#ifdef ENABLE_DROPROOT
droproot = true;
+ /* coverity[overwrite_var] Leak is real but harmless */
user = estrdup(ntp_optarg);
+ /* coverity[overwrite_var] Leak is real but harmless */
group = strrchr(user, ':');
if (group != NULL) {
size_t len;
diff --git a/ntpd/refclock_mx4200.c b/ntpd/refclock_mx4200.c
index 11505d4..b4f3aef 100644
--- a/ntpd/refclock_mx4200.c
+++ b/ntpd/refclock_mx4200.c
@@ -1544,6 +1544,7 @@ mx4200_send(struct peer *peer, char *fmt, ...)
m = write(pp->io.fd, buf, (unsigned)n);
if (m < 0)
+ /* coverity[bad_printf_format_string] */
msyslog(LOG_ERR, "mx4200_send: write: %m (%s)", buf);
mx4200_debug(peer, "mx4200_send: %d %s\n", m, buf);
va_end(ap);
diff --git a/ntpd/refclock_parse.c b/ntpd/refclock_parse.c
index 32bf86b..578d131 100644
--- a/ntpd/refclock_parse.c
+++ b/ntpd/refclock_parse.c
@@ -3110,13 +3110,13 @@ parse_control(
tt = ap(start, LEN_STATES, tt,
"; running time: %s\"", l_mktime(sum));
- tt = add_var(&out->kv_list, 32, RO);
+ add_var(&out->kv_list, 32, RO);
snprintf(tt, 32, "refclock_id=\"%s\"", parse->parse_type->cl_id);
- tt = add_var(&out->kv_list, 80, RO);
+ add_var(&out->kv_list, 80, RO);
snprintf(tt, 80, "refclock_iomode=\"%s\"", parse->binding->bd_description);
- tt = add_var(&out->kv_list, 128, RO);
+ add_var(&out->kv_list, 128, RO);
snprintf(tt, 128, "refclock_driver_version=\"%s\"", VERSION);
{
@@ -3943,7 +3943,7 @@ gps16x_message(
p = ap(buffer, sizeof(buffer),
p, "gps_tot_63=\"");
mbg_tgps_str(&p, &cfgh.tot_63, BUFFER_SIZE(buffer, p));
- p = ap(buffer, sizeof(buffer),
+ ap(buffer, sizeof(buffer),
p, "\"");
set_var(&parse->kv, buffer, sizeof(buffer), RO|COND_DEF);
@@ -3951,7 +3951,7 @@ gps16x_message(
p = ap(buffer, sizeof(buffer),
p, "gps_t0a=\"");
mbg_tgps_str(&p, &cfgh.t0a, BUFFER_SIZE(buffer, p));
- p = ap(buffer, sizeof(buffer),
+ ap(buffer, sizeof(buffer),
p, "\"");
set_var(&parse->kv, buffer, sizeof(buffer), RO|COND_DEF);
diff --git a/ntpfrob/pps-api.c b/ntpfrob/pps-api.c
index 009a56c..65adc87 100644
--- a/ntpfrob/pps-api.c
+++ b/ntpfrob/pps-api.c
@@ -91,7 +91,7 @@ void ppscheck(char *device)
pp.mode = PPS_CAPTUREBOTH;
/* pp.mode = PPS_CAPTUREASSERT; */
- /* coverity_submit[uninit_use_in_call] */
+ /* coverity[uninit_use_in_call] */
i = time_pps_setparams(ph, &pp);
if (i < 0)
err(1, "time_pps_setparams");
More information about the vc
mailing list