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 <wangxiaochen0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Xiaochen Wang 2011-03-06 22:04:15 +08:00 committed by Greg Kroah-Hartman
parent 0875abf83d
commit 9603ff50b5
1 changed files with 3 additions and 2 deletions

View File

@ -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;
}
}