From: Xiaochen Wang Date: Sun, 6 Mar 2011 14:04:15 +0000 (+0800) Subject: staging: rtl8192e use kmemdup and check its return value X-Git-Tag: MMI-PSA29.97-13-9~20521^2~243 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9603ff50b5d56e6ee64b10116ff640320732f9c8;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git staging: rtl8192e use kmemdup and check its return value use kmemdup instead of kmalloc and memcpy, and check its return value Signed-off-by: Xiaochen Wang Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c index 88a9cd1958a8..fc96676bb9ce 100644 --- a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c @@ -1564,8 +1564,9 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen) if(*(t++) == MFIE_TYPE_CHALLENGE){ *chlen = *(t++); - *challenge = kmalloc(*chlen, GFP_ATOMIC); - memcpy(*challenge, t, *chlen); + *challenge = kmemdup(t, *chlen, GFP_ATOMIC); + if (!*challenge) + return -ENOMEM; } }