提交 4a01f1c3 编写于 作者: H Hari Prasath Gujulan Elango 提交者: Greg Kroah-Hartman

staging: wilc1000: use memdup_user

This patch replaces the kmalloc followed by copy_from_user by the
wrapper routine memdup_user.
Signed-off-by: NHari Prasath Gujulan Elango <hgujulan@visteon.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 2235fb69
...@@ -2459,16 +2459,10 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) ...@@ -2459,16 +2459,10 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
size = wrq->u.data.length; size = wrq->u.data.length;
if (size && wrq->u.data.pointer) { if (size && wrq->u.data.pointer) {
buff = kmalloc(size, GFP_KERNEL);
if (!buff) {
s32Error = -ENOMEM;
goto done;
}
if (copy_from_user buff = memdup_user(wrq->u.data.pointer, wrq->u.data.length);
(buff, wrq->u.data.pointer, if (IS_ERR(buff)) {
wrq->u.data.length)) { s32Error = PTR_ERR(buff);
s32Error = -EFAULT;
goto done; goto done;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册