From: Hema Prathaban Date: Tue, 14 May 2013 15:31:22 +0000 (+0530) Subject: staging: rtl8192e: Use kmemdup for duplicating memory X-Git-Tag: firefly_0821_release~176^2~5845^2~745 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6dea0da1fff9ec1fcfc989e13cde451d5e7604ce;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: Greg Kroah-Hartman --- 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);