[Git][NTPsec/ntpsec][master] 3 commits: ntpfrob: fix incorrect coverity override of real problem.
Gary E. Miller
gitlab at mg.gitlab.com
Thu May 25 01:03:11 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
753238e7 by Gary E. Miller at 2017-05-24T12:56:28-07:00
ntpfrob: fix incorrect coverity override of real problem.
- - - - -
f0341f78 by Gary E. Miller at 2017-05-24T17:39:24-07:00
keyword-gen: make some functions static.
- - - - -
5a78b94b by Gary E. Miller at 2017-05-24T18:02:11-07:00
keyword-gen: fix memory leak, remove coverity overrides.
- - - - -
2 changed files:
- ntpd/keyword-gen.c
- ntpfrob/pps-api.c
Changes:
=====================================
ntpd/keyword-gen.c
=====================================
--- a/ntpd/keyword-gen.c
+++ b/ntpd/keyword-gen.c
@@ -232,10 +232,10 @@ static void generate_fsm (void);
static void generate_token_text (void);
static u_short create_keyword_scanner (void);
static u_short create_scan_states (const char *, u_short, follby, u_short);
-int compare_key_tok_id (const void *, const void *);
-int compare_key_tok_text (const void *, const void *);
-void populate_symb (char *);
-const char * symbname (u_short);
+static int compare_key_tok_id (const void *, const void *);
+static int compare_key_tok_text (const void *, const void *);
+static void populate_symb (char *);
+static const char * symbname (u_short);
int main(int argc, char **argv)
@@ -373,7 +373,6 @@ generate_fsm(void)
}
if (sst[i].finishes_token) {
- /* coverity[leaked_storage] */
snprintf(token_id_comment,
sizeof(token_id_comment), "%5d %-17s",
i, symbname(sst[i].finishes_token));
@@ -525,7 +524,6 @@ create_scan_states(
sst[my_state].followedby = (char)followedby;
if (sst[token].finishes_token != (u_short)token) {
- /* coverity[leaked_storage] */
fprintf(stderr,
"fatal, sst[%d] not reserved for %s.\n",
token, symbname(token));
@@ -614,7 +612,6 @@ generate_token_text(void)
}
if (i > 0)
printf(",");
- /* coverity[leaked_storage] */
printf("\n\t/* %-5d %5d %20s */\t\"%s\"",
id - lowest_id, id, symbname(id),
ntp_keywords[i].key);
@@ -626,7 +623,7 @@ generate_token_text(void)
}
-int
+static int
compare_key_tok_id(
const void *a1,
const void *a2
@@ -645,7 +642,7 @@ compare_key_tok_id(
}
-int
+static int
compare_key_tok_text(
const void *a1,
const void *a2
@@ -662,7 +659,7 @@ compare_key_tok_text(
* populate_symb() - populate symb[] lookup array with symbolic token
* names such that symb[T_Age] == "T_Age", etc.
*/
-void
+static void
populate_symb(
char *header_file
)
@@ -696,19 +693,19 @@ populate_symb(
}
-const char *
+static const char *
symbname(
u_short token
)
{
-#define BUFLENGTH 20
+ static char buf[20];
char *name;
if (token < COUNTOF(symb) && symb[token] != NULL) {
name = symb[token];
} else {
- name = malloc(BUFLENGTH);
- snprintf(name, BUFLENGTH, "%d", token);
+ snprintf(buf, sizeof(buf), "%d", token);
+ name = buf;
}
return name;
=====================================
ntpfrob/pps-api.c
=====================================
--- a/ntpfrob/pps-api.c
+++ b/ntpfrob/pps-api.c
@@ -96,7 +96,8 @@ void ppscheck(const char *device)
pp.mode = PPS_CAPTUREBOTH;
/* pp.mode = PPS_CAPTUREASSERT; */
- /* coverity[uninit_use_in_call] */
+ pp.api_version = PPS_API_VERS;
+
i = time_pps_setparams(ph, &pp);
if (i < 0)
err(1, "time_pps_setparams");
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/a13aa55654c66198049102ae6e6e3a154b3666ca...5a78b94b73be1cc2965478ddcdd7800862031456
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/a13aa55654c66198049102ae6e6e3a154b3666ca...5a78b94b73be1cc2965478ddcdd7800862031456
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/20170525/6b564c5f/attachment.html>
More information about the vc
mailing list