mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-22 13:54:57 +08:00
staging: rtl8192u: use memdup_user to simplify code
Use memdup_user rather than duplicating its implementation. Fix the following coccinelle warnings: drivers/staging/rtl8192u/r8192U_core.c:3792:7-14: WARNING opportunity for memdup_user drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:3153:9-16: WARNING opportunity for memdup_user Signed-off-by: Teodora Baluta <teobaluta@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5b66fb7d57
commit
38272d20b9
@ -3150,14 +3150,9 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
param = kmalloc(p->length, GFP_KERNEL);
|
param = memdup_user(p->pointer, p->length);
|
||||||
if (param == NULL){
|
if (IS_ERR(param)) {
|
||||||
ret = -ENOMEM;
|
ret = PTR_ERR(param);
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (copy_from_user(param, p->pointer, p->length)) {
|
|
||||||
kfree(param);
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3789,14 +3789,9 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipw = kmalloc(p->length, GFP_KERNEL);
|
ipw = memdup_user(p->pointer, p->length);
|
||||||
if (ipw == NULL) {
|
if (IS_ERR(ipw)) {
|
||||||
ret = -ENOMEM;
|
ret = PTR_ERR(ipw);
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (copy_from_user(ipw, p->pointer, p->length)) {
|
|
||||||
kfree(ipw);
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user