summaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8192e/rtllib_softmac.c
diff options
context:
space:
mode:
authorHema Prathaban2013-05-14 17:31:22 +0200
committerGreg Kroah-Hartman2013-05-15 20:23:41 +0200
commit6dea0da1fff9ec1fcfc989e13cde451d5e7604ce (patch)
treebd33148297a727e4d8fedb12f7897cdd0d20b9f2 /drivers/staging/rtl8192e/rtllib_softmac.c
parentstaging: rtl8192e: Fix potential null dereference (diff)
downloadkernel-qcow2-linux-6dea0da1fff9ec1fcfc989e13cde451d5e7604ce.tar.gz
kernel-qcow2-linux-6dea0da1fff9ec1fcfc989e13cde451d5e7604ce.tar.xz
kernel-qcow2-linux-6dea0da1fff9ec1fcfc989e13cde451d5e7604ce.zip
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>
Diffstat (limited to 'drivers/staging/rtl8192e/rtllib_softmac.c')
-rw-r--r--drivers/staging/rtl8192e/rtllib_softmac.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 8af0b9902615..aefffac556a6 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -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);