瀏覽代碼

coverity: Suppress weak_crypto errors

None of random/rand is used in security context but they are reported by
coverity and makes debugging of real issues pretty hard.

So this patch uses coverity specific comment to suppress these type
of errors.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 6 月之前
父節點
當前提交
6c1ffc8aa8
共有 4 個文件被更改,包括 5 次插入0 次删除
  1. 2 0
      exec/totemsrp.c
  2. 1 0
      test/cpghum.c
  3. 1 0
      test/cpgverify.c
  4. 1 0
      test/stress_cpgzc.c

+ 2 - 0
exec/totemsrp.c

@@ -3374,6 +3374,7 @@ static void memb_join_message_send (struct totemsrp_instance *instance)
 		sizeof (struct srp_addr);
 
 	if (instance->totem_config->send_join_timeout) {
+		// coverity[DC.WEAK_CRYPTO:SUPPRESS] random is not used in a security context
 		usleep (random() % (instance->totem_config->send_join_timeout * 1000));
 	}
 
@@ -3455,6 +3456,7 @@ static void memb_leave_message_send (struct totemsrp_instance *instance)
 
 
 	if (instance->totem_config->send_join_timeout) {
+		// coverity[DC.WEAK_CRYPTO:SUPPRESS] random is not used in a security context
 		usleep (random() % (instance->totem_config->send_join_timeout * 1000));
 	}
 	instance->stats.memb_join_tx++;

+ 1 - 0
test/cpghum.c

@@ -355,6 +355,7 @@ static void set_packet(int write_size, int counter)
 
 	header->counter = counter;
 	for (i=0; i<(datalen/4); i++) {
+		// coverity[DC.WEAK_CRYPTO:SUPPRESS] rand is not used in a security context
 		dataint[i] = rand();
 	}
 	crc = crc32(0, NULL, 0);

+ 1 - 0
test/cpgverify.c

@@ -151,6 +151,7 @@ int main (int argc, char *argv[])
 	 */
 	i = 0;
 	do {
+		// coverity[DC.WEAK_CRYPTO:SUPPRESS] rand is not used in a security context
 		msg.msg_size = 100 + rand() % 100000;
 		iov[1].iov_len = msg.msg_size;
 		for (j = 0; j < msg.msg_size; j++) {

+ 1 - 0
test/stress_cpgzc.c

@@ -107,6 +107,7 @@ int main (void)
 
 	for (j = 0; j < ITERATIONS; j++) {
 		for (i = 0; i < ALLOCATIONS; i++) {
+			// coverity[DC.WEAK_CRYPTO:SUPPRESS] random is not used in a security context
 			buffer_lens[i] = (random() % MAX_SIZE) + 1;
 			res = cpg_zcb_alloc (
 				handle,