From: Hari Prasath Gujulan Elango <hgujulan@xxxxxxxxxxx> This patch replaces the kmalloc followed by copy_from_user by the wrapper routine memdup_user. Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@xxxxxxxxxxx> --- drivers/staging/wilc1000/linux_wlan.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index e92ba59..173b958 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; } -- 1.9.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel