git: f19ae3633be1 - main - ifconfig: Pacify a sign comparison warning in regdomain_sort.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 19 Jun 2023 17:38:31 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=f19ae3633be133c8a30dd9b709451ce71e147bcb

commit f19ae3633be133c8a30dd9b709451ce71e147bcb
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-06-19 17:38:18 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-06-19 17:38:18 +0000

    ifconfig: Pacify a sign comparison warning in regdomain_sort.
    
    Both ic_flags values are unsigned (uint32_t), so cast them to a signed
    int to generate a signed result.  Both ic_req values are also
    unsigned, but since they are uint16_t, they are implicitly promited to
    int before the subtraction.
    
    Reported by:    GCC -Wsign-compare
    Reviewed by:    emaste
    Differential Revision:  https://reviews.freebsd.org/D40610
---
 sbin/ifconfig/ifieee80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index 93477f999003..c0f53a012dfa 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -2062,7 +2062,7 @@ regdomain_sort(const void *a, const void *b)
 	const struct ieee80211_channel *cb = b;
 
 	return ca->ic_freq == cb->ic_freq ?
-	    (ca->ic_flags & CHAN_ALL) - (cb->ic_flags & CHAN_ALL) :
+	    (int)(ca->ic_flags & CHAN_ALL) - (int)(cb->ic_flags & CHAN_ALL) :
 	    ca->ic_freq - cb->ic_freq;
 #undef CHAN_ALL
 }