diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-10-10 12:52:10 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-10-11 15:04:23 -0400 |
commit | 730bd83b036e72b0134352ca27e76ea08475fbf1 (patch) | |
tree | 541b14e5985928d513011b1347e10bf6f3cda55c | |
parent | cc2858c987f41286e059ee777c3bc09f7b7c19f6 (diff) |
mac80211: don't kmalloc 16 bytes
Since this small buffer isn't used for DMA,
we can simply allocate it on the stack, it
just needs to be 16 bytes of which only 8
will be used for WEP40 keys.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | net/mac80211/wep.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c index f27484c22b9f..2ff6d1e3ed21 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -222,7 +222,7 @@ static int ieee80211_wep_decrypt(struct ieee80211_local *local, | |||
222 | struct ieee80211_key *key) | 222 | struct ieee80211_key *key) |
223 | { | 223 | { |
224 | u32 klen; | 224 | u32 klen; |
225 | u8 *rc4key; | 225 | u8 rc4key[3 + WLAN_KEY_LEN_WEP104]; |
226 | u8 keyidx; | 226 | u8 keyidx; |
227 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 227 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
228 | unsigned int hdrlen; | 228 | unsigned int hdrlen; |
@@ -245,10 +245,6 @@ static int ieee80211_wep_decrypt(struct ieee80211_local *local, | |||
245 | 245 | ||
246 | klen = 3 + key->conf.keylen; | 246 | klen = 3 + key->conf.keylen; |
247 | 247 | ||
248 | rc4key = kmalloc(klen, GFP_ATOMIC); | ||
249 | if (!rc4key) | ||
250 | return -1; | ||
251 | |||
252 | /* Prepend 24-bit IV to RC4 key */ | 248 | /* Prepend 24-bit IV to RC4 key */ |
253 | memcpy(rc4key, skb->data + hdrlen, 3); | 249 | memcpy(rc4key, skb->data + hdrlen, 3); |
254 | 250 | ||
@@ -260,8 +256,6 @@ static int ieee80211_wep_decrypt(struct ieee80211_local *local, | |||
260 | len)) | 256 | len)) |
261 | ret = -1; | 257 | ret = -1; |
262 | 258 | ||
263 | kfree(rc4key); | ||
264 | |||
265 | /* Trim ICV */ | 259 | /* Trim ICV */ |
266 | skb_trim(skb, skb->len - WEP_ICV_LEN); | 260 | skb_trim(skb, skb->len - WEP_ICV_LEN); |
267 | 261 | ||