From: Johannes Berg <johannes@sipsolutions.net>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: "John W. Linville" <linville@tuxdriver.com>,
linux-next@vger.kernel.org,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: [PATCH] mac80211: fix variable truncation on 32-bit
Date: Wed, 22 Apr 2009 11:25:43 +0200 [thread overview]
Message-ID: <1240392343.20308.6.camel@johannes.local> (raw)
In-Reply-To: <20090422144537.06937b16.sfr@canb.auug.org.au>
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,
prev parent reply other threads:[~2009-04-22 9:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-22 4:45 linux-next: wireless tree build warning Stephen Rothwell
2009-04-22 9:25 ` Johannes Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1240392343.20308.6.camel@johannes.local \
--to=johannes@sipsolutions.net \
--cc=linux-next@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox