From: Xiaochen Wang Date: Fri, 4 Mar 2011 05:09:00 +0000 (+0800) Subject: staging: rtl8187se: check kmalloc return value X-Git-Tag: firefly_0821_release~7613^2~2197^2~244 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0875abf83df7d74bf9858c125e82835bd1ca349c;p=firefly-linux-kernel-4.4.55.git staging: rtl8187se: check kmalloc return value check kmalloc return value Signed-off-by: Xiaochen Wang Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index 652d879509e6..74a3b4c211ad 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -1435,8 +1435,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; } }