Page MenuHomeFreeBSD

ifconfig: fix comparison in printmimo()
ClosedPublic

Authored by melifaro on May 27 2023, 12:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 17, 4:24 PM
Unknown Object (File)
Wed, Feb 26, 6:27 AM
Unknown Object (File)
Tue, Feb 25, 7:10 PM
Unknown Object (File)
Tue, Feb 25, 12:45 PM
Unknown Object (File)
Tue, Feb 25, 9:23 AM
Unknown Object (File)
Feb 7 2025, 6:42 PM
Unknown Object (File)
Feb 7 2025, 6:42 PM
Unknown Object (File)
Feb 5 2025, 9:04 PM
Subscribers

Details

Summary

Currently compiler yells at printmimo() with the following warning:

/usr/home/melifaro/free/head/sbin/ifconfig/ifieee80211.c:3716:17: error: comparison of array 'mi->ch[i].rssi' not equal to a null pointer is always true [-Werror,-Wtautological-pointer-compare]
                if (mi->ch[i].rssi != 0) {
                    ~~~~~~~~~~^~~~    ~

To check:

--- a/sbin/ifconfig/Makefile
+++ b/sbin/ifconfig/Makefile
@@ -80,7 +80,8 @@ CFLAGS+=-DWITHOUT_NETLINK
 MAN=   ifconfig.8

 CFLAGS+= -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wnested-externs
-WARNS?=        2
+CFLAGS+=-Wno-error=unused-parameter -Wno-error=shadow
+#WARNS?=       2

I have no domain knowledge whether the fix is valid or not, but the code before 617f8b101e7f checked rssi[0].

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 51734
Build 48625: arc lint + arc unit