mac80211: incorrect shift direction
authorHarvey Harrison <harvey.harrison@gmail.com>
Sun, 27 Apr 2008 10:48:40 +0000 (03:48 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 1 May 2008 00:34:26 +0000 (20:34 -0400)
Looks like  5d2cdcd4e85c5187db30a6b29f79fbbe59f39f78 ("mac80211: get a
TKIP phase key from skb") got the shifts wrong.

Noticed by sparse:
net/mac80211/tkip.c:234:25: warning: right shift by bigger than source value
net/mac80211/tkip.c:235:25: warning: right shift by bigger than source value
net/mac80211/tkip.c:236:25: warning: right shift by bigger than source value

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/tkip.c

index dddbfd60f35148e790a46d80db2ae70821f7850e..09093da24af625f8d42db34d9f285734c1e7b5d3 100644 (file)
@@ -230,10 +230,8 @@ void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf,
 
        iv16 = data[hdr_len] << 8;
        iv16 += data[hdr_len + 2];
-       iv32 = data[hdr_len + 4] +
-               (data[hdr_len + 5] >> 8) +
-               (data[hdr_len + 6] >> 16) +
-               (data[hdr_len + 7] >> 24);
+       iv32 = data[hdr_len + 4] | (data[hdr_len + 5] << 8) |
+              (data[hdr_len + 6] << 16) | (data[hdr_len + 7] << 24);
 
 #ifdef CONFIG_TKIP_DEBUG
        printk(KERN_DEBUG "TKIP encrypt: iv16 = 0x%04x, iv32 = 0x%08x\n",