Sfoglia il codice sorgente

staging: wlan-ng: check return value of kmalloc

check return value of kmalloc before accessing the memory pointer and
return -ENOMEM if allocation fails.

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gujulan Elango, Hari Prasath (H.) 10 anni fa
parent
commit
4bff39dfb7
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      drivers/staging/wlan-ng/p80211conv.c

+ 2 - 0
drivers/staging/wlan-ng/p80211conv.c

@@ -207,6 +207,8 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv,
 		/* XXXX need to pick keynum other than default? */
 
 		p80211_wep->data = kmalloc(skb->len, GFP_ATOMIC);
+		if (!p80211_wep->data)
+			return -ENOMEM;
 		foo = wep_encrypt(wlandev, skb->data, p80211_wep->data,
 				  skb->len,
 				  (wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK),