Skip to content

Commit

Permalink
mac80211: fix variable truncation on 32-bit
Browse files Browse the repository at this point in the history
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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Apr 22, 2009
1 parent eb1a685 commit 1d4df3a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1743,12 +1743,12 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
* 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,
Expand Down

0 comments on commit 1d4df3a

Please sign in to comment.