Skip to contentSkip to conversation

mac80211: fix 1-bit bitfield to unsigned

PATCH In review Randy Dunlap 2 participants 3 messages Jun 6, 2007 – Jun 8, 2007 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix 1-bit bitfield to unsigned

From: Randy Dunlap <[email protected]>

Fix 17 of these pairs of sparse warnings since it's difficult for a 1-bit bitfield to have both a value bit and a sign bit.

net/mac80211/sta_info.h:105:16: error: dubious bitfield without explicit signed' or unsigned' net/mac80211/sta_info.h:107:15: error: dubious bitfield without explicit signed' or unsigned'

---
 net/mac80211/sta_info.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/mac80211/sta_info.h +3 -3
@@ -102,9 +102,9 @@ struct sta_info {
 #ifdef CONFIG_MAC80211_DEBUGFS
 	int debugfs_registered;
 #endif
-	int assoc_ap:1; /* whether this is an AP that we are
-			 * associated with as a client */
-	int dls_sta:1; /* whether this stations is a DLS peer of us */
+	unsigned int assoc_ap:1; /* whether this is an AP that we are
+				  * associated with as a client */
+	unsigned int dls_sta:1; /* whether this stations is a DLS peer of us */
 
 #define DLS_STATUS_OK		0
 #define DLS_STATUS_NOLINK	1
maintainer
#1 lore raw

Very interesting. We were wondering why the latest git tree doesn't show tons of endianness warnings, but it appears that when sparse finds these dubious bitfields it turns off all other warnings.

Zhu Yi, can you apply this patch to your tree and review your code and the sparse output and stick le16_to_cpu()/le32_to_cpu() into the appropriate places? A whole bunch of things there are endianness broken and sparse probably only gives you an approximation of what errors there are.

johannes

maintainer
#2 lore raw
Quoted 9 lines · Johannes Berg

Very interesting. We were wondering why the latest git tree doesn't show tons of endianness warnings, but it appears that when sparse finds these dubious bitfields it turns off all other warnings.

Zhu Yi, can you apply this patch to your tree and review your code and the sparse output and stick le16_to_cpu()/le32_to_cpu() into the appropriate places? A whole bunch of things there are endianness broken and sparse probably only gives you an approximation of what errors there are.

Oh, forgot to mention you need to run
make C=2 CHECKFLAGS="-D__CHECK_ENDIAN__" M=net/mac80211/

(if you weren't aware already.)

johannes