Commit 730bd83b036e72b0134352ca27e76ea08475fbf1

Authored by Johannes Berg
Committed by John W. Linville
1 parent cc2858c987

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>

Showing 1 changed file with 1 additions and 7 deletions Side-by-side Diff

... ... @@ -222,7 +222,7 @@
222 222 struct ieee80211_key *key)
223 223 {
224 224 u32 klen;
225   - u8 *rc4key;
  225 + u8 rc4key[3 + WLAN_KEY_LEN_WEP104];
226 226 u8 keyidx;
227 227 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
228 228 unsigned int hdrlen;
... ... @@ -245,10 +245,6 @@
245 245  
246 246 klen = 3 + key->conf.keylen;
247 247  
248   - rc4key = kmalloc(klen, GFP_ATOMIC);
249   - if (!rc4key)
250   - return -1;
251   -
252 248 /* Prepend 24-bit IV to RC4 key */
253 249 memcpy(rc4key, skb->data + hdrlen, 3);
254 250  
... ... @@ -259,8 +255,6 @@
259 255 skb->data + hdrlen + WEP_IV_LEN,
260 256 len))
261 257 ret = -1;
262   -
263   - kfree(rc4key);
264 258  
265 259 /* Trim ICV */
266 260 skb_trim(skb, skb->len - WEP_ICV_LEN);