[ntpsec-main commit] Coverity warning suppression.

Eric S. Raymond esr at ntpsec.org
Sat Nov 7 14:47:13 UTC 2015


Module:    ntpsec-main
Branch:    master
Commit:    5166f5cdc11d0fb4746e10dc9633d465711d2a6b
Changeset: http://git.ntpsec.org//commit/?id=5166f5cdc11d0fb4746e10dc9633d465711d2a6b

Author:    Eric S. Raymond <esr at thyrsus.com>
Date:      Sat Nov  7 09:46:49 2015 -0500

Coverity warning suppression.

---

 ntpd/ntp_monitor.c     |  1 +
 ntpd/refclock_mx4200.c |  3 +--
 ntpd/refclock_parse.c  | 12 +++++++-----
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/ntpd/ntp_monitor.c b/ntpd/ntp_monitor.c
index 2fcef93..8ede47f 100644
--- a/ntpd/ntp_monitor.c
+++ b/ntpd/ntp_monitor.c
@@ -459,6 +459,7 @@ ntp_monitor(
 			   (double)oldest_age / mon_age) {
 			return ~(RES_LIMITED | RES_KOD) & flags;
 		} else {
+			/* coverity[var_deref_model] */
 			mon_reclaim_entry(oldest);
 			mon = oldest;
 		}
diff --git a/ntpd/refclock_mx4200.c b/ntpd/refclock_mx4200.c
index b4f3aef..6130d06 100644
--- a/ntpd/refclock_mx4200.c
+++ b/ntpd/refclock_mx4200.c
@@ -1544,8 +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);
+	    msyslog(LOG_ERR, "mx4200_send: write: %s [%s]", buf, strerror(errno));
 	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 578d131..d47a439 100644
--- a/ntpd/refclock_parse.c
+++ b/ntpd/refclock_parse.c
@@ -3001,11 +3001,11 @@ parse_control(
 
 		if (parse->timedata.parse_time.fp.l_ui == 0)
 		{
-			tt = ap(start, 128, tt, "<UNDEFINED>\"");
+			ap(start, 128, tt, "<UNDEFINED>\"");
 		}
 		else
 		{
-			tt = ap(start, 128, tt, "%s\"",
+			ap(start, 128, tt, "%s\"",
 			    gmprettydate(&parse->timedata.parse_time.fp));
 		}
 
@@ -3909,7 +3909,7 @@ gps16x_message(
 						break;
 					}
 
-					p = ap(buffer, sizeof(buffer), p, "\"");
+					ap(buffer, sizeof(buffer), p, "\"");
 
 					set_var(&parse->kv, buffer, sizeof(buffer), RO|DEF);
 				}
@@ -3935,7 +3935,7 @@ gps16x_message(
 						p = ap(buffer, sizeof(buffer),
 						    p, "gps_tot_51=\"");
 						mbg_tgps_str(&p, &cfgh.tot_51, BUFFER_SIZE(buffer, p));
-						p = ap(buffer, sizeof(buffer),
+						ap(buffer, sizeof(buffer),
 						    p, "\"");
 						set_var(&parse->kv, buffer, sizeof(buffer), RO|COND_DEF);
 
@@ -4081,7 +4081,7 @@ gps16x_message(
 }
 
 /*------------------------------------------------------------
- * gps16x_poll - query the reciver peridically
+ * gps16x_poll - query the receiver periodically
  */
 static void
 gps16x_poll(
@@ -4719,6 +4719,8 @@ trimbletsip_init(
 	}
 	else
 	{
+		/* The macro value is actually unsigned */
+		/* coverity[negative_returns] */
 		if ((parse_clockinfo[CLK_TYPE(parse->peer)].cl_lflag & ICANON))
 		{
 #ifdef VEOL



More information about the vc mailing list