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

Commit 6dea0da1 authored by Hema Prathaban's avatar Hema Prathaban Committed by Greg Kroah-Hartman
Browse files

staging: rtl8192e: Use kmemdup for duplicating memory



Instead of allocating memory (kmalloc) and copying (memcpy)
from source, memory can be duplicated using kmemdup

Signed-off-by: default avatarHema Prathaban <hemaklnce@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ae053253
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1801,10 +1801,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);
			*challenge = kmemdup(t, *chlen, GFP_ATOMIC);
			if (!*challenge)
				return -ENOMEM;
			memcpy(*challenge, t, *chlen);
		}
	}
	return cpu_to_le16(a->status);