Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9603ff50 authored by Xiaochen Wang's avatar Xiaochen Wang Committed by Greg Kroah-Hartman
Browse files

staging: rtl8192e use kmemdup and check its return value



use kmemdup instead of kmalloc and memcpy,
and check its return value

Signed-off-by: default avatarXiaochen Wang <wangxiaochen0@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0875abf8
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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;
		}
	}