Skip to content

Commit

Permalink
staging: rtl8192e: Use kmemdup for duplicating memory
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hema Prathaban authored and Greg Kroah-Hartman committed May 15, 2013
1 parent ae05325 commit 6dea0da
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/rtl8192e/rtllib_softmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6dea0da

Please sign in to comment.