[Git][NTPsec/ntpsec][master] More trivial Coverity suppressions.

Eric S. Raymond gitlab at mg.gitlab.com
Tue Sep 1 22:38:41 UTC 2020



Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
3c9faa76 by Eric S. Raymond at 2020-09-01T18:39:02-04:00
More trivial Coverity suppressions.

- - - - -


3 changed files:

- attic/random.c
- ntpd/ntp_control.c
- tests/unity/unity_memory.c


Changes:

=====================================
attic/random.c
=====================================
@@ -151,7 +151,7 @@ static int do_fastest(void) {
 
 	for (int i = 0; i < BATCHSIZE; i++) {
                 clock_gettime(CLOCK_REALTIME, &start);
-		/* coverity[weak_crypto] */
+		/* coverity[dc,weak_crypto] */
 		sum += random();
 		clock_gettime(CLOCK_REALTIME, &stop);
 		sec = (stop.tv_sec-start.tv_sec);


=====================================
ntpd/ntp_control.c
=====================================
@@ -3202,6 +3202,7 @@ send_random_tag_value(
 	int	noise;
 	char	buf[32];
 
+	/* coverity[dc.weak_crypto] */
 	noise = random();
 	buf[0] = 'a' + noise % 26;
 	noise >>= 5;
@@ -3245,6 +3246,7 @@ send_mru_entry(
 
 	remaining = COUNTOF(sent);
 	ZERO(sent);
+	/* coverity[dc.weak_crypto] */
 	noise = (uint32_t)random();
 	while (remaining > 0) {
 #ifdef USE_RANDOMIZE_RESPONSES
@@ -3766,6 +3768,7 @@ send_ifstats_entry(
 	noisebits = 0;
 	while (remaining > 0) {
 		if (noisebits < 4) {
+			/* coverity[dc.weak_crypto] */
 			noise = (uint32_t)random();
 			noisebits = 31;
 		}
@@ -3943,6 +3946,7 @@ send_restrict_entry(
 	noisebits = 0;
 	while (remaining > 0) {
 		if (noisebits < 2) {
+			/* coverity[dc.weak_crypto] */
 			noise = (uint32_t)random();
 			noisebits = 31;
 		}


=====================================
tests/unity/unity_memory.c
=====================================
@@ -196,8 +196,11 @@ void* unity_realloc(void* oldMem, size_t size)
     }
 #endif
     newMem = unity_malloc(size);
-    if (newMem == NULL) return NULL; /* Do not release old memory */
-    memcpy(newMem, oldMem, guard->size);
-    release_memory(oldMem);
-    return newMem;
+    if (newMem == NULL)
+	return NULL; /* Do not release old memory */
+    else {
+	memcpy(newMem, oldMem, guard->size);
+	release_memory(oldMem);
+	return newMem;
+    }
 }



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/3c9faa76e9bc4d42af8291f6e2f2ab8401bf3e4d

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/3c9faa76e9bc4d42af8291f6e2f2ab8401bf3e4d
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/20200901/3f249305/attachment-0001.htm>


More information about the vc mailing list