Linux-Next discussions
 help / color / mirror / Atom feed
* linux-next: wireless tree build warning
@ 2009-04-22  4:45 Stephen Rothwell
  2009-04-22  9:25 ` [PATCH] mac80211: fix variable truncation on 32-bit Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Rothwell @ 2009-04-22  4:45 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-next, Johannes Berg

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

Hi John,

Today's linux-next build (i386 defconfig) produced these warnings:

net/mac80211/mlme.c:1771: warning: left shift count >= width of type
net/mac80211/mlme.c:1772: warning: left shift count >= width of type
net/mac80211/mlme.c:1773: warning: left shift count >= width of type
net/mac80211/mlme.c:1774: warning: left shift count >= width of type
net/mac80211/mlme.c:1775: warning: left shift count >= width of type

Caused by commit cf4473dfd0e7dbe173be994fe226f88c48a02dd0 ("mac80211:
implement beacon filtering in software").
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] mac80211: fix variable truncation on 32-bit
  2009-04-22  4:45 linux-next: wireless tree build warning Stephen Rothwell
@ 2009-04-22  9:25 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2009-04-22  9:25 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: John W. Linville, linux-next, linux-wireless

Stephen Rothwell reported these warnings from a 32-bit build:

  net/mac80211/mlme.c:1771: warning: left shift count >= width of type
  net/mac80211/mlme.c:1772: warning: left shift count >= width of type
  net/mac80211/mlme.c:1773: warning: left shift count >= width of type
  net/mac80211/mlme.c:1774: warning: left shift count >= width of type
  net/mac80211/mlme.c:1775: warning: left shift count >= width of type

This shows a bug in my code -- BIT(X) uses just "1 << X" which means
a 32-bit integer on 32-bit platforms, but the code here needs a u64
on all platforms. Fix this by using "1ULL << X" instead of BIT(X).

Thanks Stephen!

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/mlme.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- wireless-testing.orig/net/mac80211/mlme.c	2009-04-22 11:19:20.000000000 +0200
+++ wireless-testing/net/mac80211/mlme.c	2009-04-22 11:19:54.000000000 +0200
@@ -1743,12 +1743,12 @@ static void ieee80211_rx_mgmt_probe_resp
  *	look out for other vendor IEs.
  */
 static const u64 care_about_ies =
-	BIT(WLAN_EID_COUNTRY) |
-	BIT(WLAN_EID_ERP_INFO) |
-	BIT(WLAN_EID_CHANNEL_SWITCH) |
-	BIT(WLAN_EID_PWR_CONSTRAINT) |
-	BIT(WLAN_EID_HT_CAPABILITY) |
-	BIT(WLAN_EID_HT_INFORMATION);
+	(1ULL << WLAN_EID_COUNTRY) |
+	(1ULL << WLAN_EID_ERP_INFO) |
+	(1ULL << WLAN_EID_CHANNEL_SWITCH) |
+	(1ULL << WLAN_EID_PWR_CONSTRAINT) |
+	(1ULL << WLAN_EID_HT_CAPABILITY) |
+	(1ULL << WLAN_EID_HT_INFORMATION);
 
 static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 				     struct ieee80211_mgmt *mgmt,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-22  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-22  4:45 linux-next: wireless tree build warning Stephen Rothwell
2009-04-22  9:25 ` [PATCH] mac80211: fix variable truncation on 32-bit Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox