public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: passt-dev@passt.top
Cc: Laurent Vivier <lvivier@redhat.com>
Subject: [PATCH] ndp: Suppress Coverity false positive for random()
Date: Wed, 13 May 2026 12:26:17 +0200	[thread overview]
Message-ID: <20260513102617.1325915-1-lvivier@redhat.com> (raw)

Coverity flags the random() call in ndp_timer() with the dont_call
checker, warning that it should not be used for security-related
applications.

This is a false positive: random() is used here to jitter the interval
between unsolicited Router Advertisements as required by RFC 4861, to
prevent synchronisation between routers on a link.  No cryptographic
strength is needed.

Suppress the warning with an inline Coverity annotation.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 ndp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ndp.c b/ndp.c
index 1f2bcb0cc7ea..614932ac5829 100644
--- a/ndp.c
+++ b/ndp.c
@@ -441,6 +441,7 @@ void ndp_timer(const struct ctx *c, const struct timespec *now)
 	 * again, it's close enough for our purposes.
 	 */
 	interval = min_rtr_adv_interval +
+		/* coverity[dont_call:FALSE] */
 		random() % (max_rtr_adv_interval - min_rtr_adv_interval);
 
 	if (!next_ra)
-- 
2.54.0


                 reply	other threads:[~2026-05-13 10:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260513102617.1325915-1-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).