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>
This commit is contained in:
parent
cc2858c987
commit
730bd83b03
1 changed files with 1 additions and 7 deletions
|
@ -222,7 +222,7 @@ static int ieee80211_wep_decrypt(struct ieee80211_local *local,
|
||||||
struct ieee80211_key *key)
|
struct ieee80211_key *key)
|
||||||
{
|
{
|
||||||
u32 klen;
|
u32 klen;
|
||||||
u8 *rc4key;
|
u8 rc4key[3 + WLAN_KEY_LEN_WEP104];
|
||||||
u8 keyidx;
|
u8 keyidx;
|
||||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||||
unsigned int hdrlen;
|
unsigned int hdrlen;
|
||||||
|
@ -245,10 +245,6 @@ static int ieee80211_wep_decrypt(struct ieee80211_local *local,
|
||||||
|
|
||||||
klen = 3 + key->conf.keylen;
|
klen = 3 + key->conf.keylen;
|
||||||
|
|
||||||
rc4key = kmalloc(klen, GFP_ATOMIC);
|
|
||||||
if (!rc4key)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Prepend 24-bit IV to RC4 key */
|
/* Prepend 24-bit IV to RC4 key */
|
||||||
memcpy(rc4key, skb->data + hdrlen, 3);
|
memcpy(rc4key, skb->data + hdrlen, 3);
|
||||||
|
|
||||||
|
@ -260,8 +256,6 @@ static int ieee80211_wep_decrypt(struct ieee80211_local *local,
|
||||||
len))
|
len))
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
kfree(rc4key);
|
|
||||||
|
|
||||||
/* Trim ICV */
|
/* Trim ICV */
|
||||||
skb_trim(skb, skb->len - WEP_ICV_LEN);
|
skb_trim(skb, skb->len - WEP_ICV_LEN);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue