public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] fwd: Squash different-signedness comparison warning
@ 2024-11-06  1:43 David Gibson
  0 siblings, 0 replies; only message in thread
From: David Gibson @ 2024-11-06  1:43 UTC (permalink / raw)
  To: passt-dev, Stefano Brivio; +Cc: David Gibson

On certain architectures we get a warning about comparison between
different signedness integers in fwd_probe_ephemeral().  This is because
NUM_PORTS evaluates to an unsigned integer.  It's a fixed value, though
and we know it will fit in a signed long on anything reasonable, so add
a cast to suppress the warning.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 fwd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fwd.c b/fwd.c
index c71f5e1..0b7f8b1 100644
--- a/fwd.c
+++ b/fwd.c
@@ -75,8 +75,8 @@ void fwd_probe_ephemeral(void)
 	if (*end || errno)
 		goto parse_err;
 
-	if (min < 0 || min >= NUM_PORTS ||
-	    max < 0 || max >= NUM_PORTS)
+	if (min < 0 || min >= (long)NUM_PORTS ||
+	    max < 0 || max >= (long)NUM_PORTS)
 		goto parse_err;
 
 	fwd_ephemeral_min = min;
-- 
@@ -75,8 +75,8 @@ void fwd_probe_ephemeral(void)
 	if (*end || errno)
 		goto parse_err;
 
-	if (min < 0 || min >= NUM_PORTS ||
-	    max < 0 || max >= NUM_PORTS)
+	if (min < 0 || min >= (long)NUM_PORTS ||
+	    max < 0 || max >= (long)NUM_PORTS)
 		goto parse_err;
 
 	fwd_ephemeral_min = min;
-- 
2.47.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-11-06  1:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-06  1:43 [PATCH] fwd: Squash different-signedness comparison warning David Gibson

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).