提交 6dea0da1 编写于 作者: H Hema Prathaban 提交者: Greg Kroah-Hartman

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: NHema Prathaban <hemaklnce@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 ae053253
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册