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>
This commit is contained in:
parent
7f804436fb
commit
4bff39dfb7
|
@ -207,6 +207,8 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv,
|
||||||
/* XXXX need to pick keynum other than default? */
|
/* XXXX need to pick keynum other than default? */
|
||||||
|
|
||||||
p80211_wep->data = kmalloc(skb->len, GFP_ATOMIC);
|
p80211_wep->data = kmalloc(skb->len, GFP_ATOMIC);
|
||||||
|
if (!p80211_wep->data)
|
||||||
|
return -ENOMEM;
|
||||||
foo = wep_encrypt(wlandev, skb->data, p80211_wep->data,
|
foo = wep_encrypt(wlandev, skb->data, p80211_wep->data,
|
||||||
skb->len,
|
skb->len,
|
||||||
(wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK),
|
(wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK),
|
||||||
|
|
Loading…
Reference in a new issue