diff options
author | Hari Prasath Gujulan Elango <hgujulan@visteon.com> | 2015-06-11 07:48:13 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-06-11 09:11:32 -0700 |
commit | 4a01f1c3abd6aa65bef32d14ba7b37a237c894d4 (patch) | |
tree | 4d7fa1756aca55c20b68dccb9848d6334d7637d1 | |
parent | 2235fb69ef09e0bc0f8b8fb94d1375bdf9d78bf3 (diff) |
staging: wilc1000: use memdup_user
This patch replaces the kmalloc followed by copy_from_user by the
wrapper routine memdup_user.
Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/wilc1000/linux_wlan.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 3aa9a4b6b4f0..387d4ecc2f2c 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -2459,16 +2459,10 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) size = wrq->u.data.length; if (size && wrq->u.data.pointer) { - buff = kmalloc(size, GFP_KERNEL); - if (!buff) { - s32Error = -ENOMEM; - goto done; - } - if (copy_from_user - (buff, wrq->u.data.pointer, - wrq->u.data.length)) { - s32Error = -EFAULT; + buff = memdup_user(wrq->u.data.pointer, wrq->u.data.length); + if (IS_ERR(buff)) { + s32Error = PTR_ERR(buff); goto done; } |