提交 8432ebd6 编写于 作者: R Rajan Vaja 提交者: Kalle Valo

hostap: Use memdup_user() to reuse code

Fix coccicheck warning which recommends to
use memdup_user() instead of reimplementing its
code.

This patch fixes below coccicheck warnings:

drivers/net/wireless/intersil/hostap/hostap_ioctl.c:3044:9-16: WARNING
opportunity for memdup_user
drivers/net/wireless/intersil/hostap/hostap_ioctl.c:3806:9-16: WARNING
opportunity for memdup_user
Signed-off-by: NRajan Vaja <rajan.vaja@gmail.com>
Reviewed-by: NJulian Calaby <julian.calaby@gmail.com>
Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
上级 c2da9133
......@@ -3041,13 +3041,9 @@ static int prism2_ioctl_priv_download(local_info_t *local, struct iw_point *p)
p->length > 1024 || !p->pointer)
return -EINVAL;
param = kmalloc(p->length, GFP_KERNEL);
if (param == NULL)
return -ENOMEM;
if (copy_from_user(param, p->pointer, p->length)) {
ret = -EFAULT;
goto out;
param = memdup_user(p->pointer, p->length);
if (IS_ERR(param)) {
return PTR_ERR(param);
}
if (p->length < sizeof(struct prism2_download_param) +
......@@ -3803,13 +3799,9 @@ static int prism2_ioctl_priv_hostapd(local_info_t *local, struct iw_point *p)
p->length > PRISM2_HOSTAPD_MAX_BUF_SIZE || !p->pointer)
return -EINVAL;
param = kmalloc(p->length, GFP_KERNEL);
if (param == NULL)
return -ENOMEM;
if (copy_from_user(param, p->pointer, p->length)) {
ret = -EFAULT;
goto out;
param = memdup_user(p->pointer, p->length);
if (IS_ERR(param)) {
return PTR_ERR(param);
}
switch (param->cmd) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册