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: Hema Prathaban <hemaklnce@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ae053253a7
commit
6dea0da1ff
|
@ -1801,10 +1801,9 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
|
||||||
|
|
||||||
if (*(t++) == MFIE_TYPE_CHALLENGE) {
|
if (*(t++) == MFIE_TYPE_CHALLENGE) {
|
||||||
*chlen = *(t++);
|
*chlen = *(t++);
|
||||||
*challenge = kmalloc(*chlen, GFP_ATOMIC);
|
*challenge = kmemdup(t, *chlen, GFP_ATOMIC);
|
||||||
if (!*challenge)
|
if (!*challenge)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memcpy(*challenge, t, *chlen);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cpu_to_le16(a->status);
|
return cpu_to_le16(a->status);
|
||||||
|
|
Loading…
Reference in New Issue