diff options
author | Teodora Baluta | 2013-10-26 08:18:22 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2013-10-28 22:47:07 +0100 |
commit | 216249819ff9fac9ba9f2d06c26194669b42a94a (patch) | |
tree | ce62751d2695da7f91669d4e6944333fe655c5ae /drivers/staging/rtl8192e/rtllib_softmac.c | |
parent | staging: rtl8187se: delete duplicated argument to | (diff) | |
download | kernel-qcow2-linux-216249819ff9fac9ba9f2d06c26194669b42a94a.tar.gz kernel-qcow2-linux-216249819ff9fac9ba9f2d06c26194669b42a94a.tar.xz kernel-qcow2-linux-216249819ff9fac9ba9f2d06c26194669b42a94a.zip |
staging: rtl8192e: use memdup_user to simplify code
Use memdup_user rather than duplicating its implementation. This patch
fixes the following coccinelle warnings:
drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2598:8-15: WARNING opportunity for memdup_user
drivers/staging/rtl8192e/rtllib_softmac.c:3594:9-16: WARNING opportunity for memdup_user
Signed-off-by: Teodora Baluta <teobaluta@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.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index e74d24212a39..671fb5ac5744 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -3590,14 +3590,9 @@ int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee, struct iw_point *p, goto out; } - param = kmalloc(p->length, GFP_KERNEL); - if (param == NULL) { - ret = -ENOMEM; - goto out; - } - if (copy_from_user(param, p->pointer, p->length)) { - kfree(param); - ret = -EFAULT; + param = memdup_user(p->pointer, p->length); + if (IS_ERR(param)) { + ret = PTR_ERR(param); goto out; } |