summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTeodora Baluta <teobaluta@gmail.com>2013-10-25 08:27:09 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-28 21:28:35 (GMT)
commit38272d20b9e20f6c0e9a5f138dd1cb8ecdf45962 (patch)
tree963f66f3642cc568f0f4f0e37e8988efea7e9a8b /drivers
parent5b66fb7d57462f5c0683f7d64625652ffb9f5f87 (diff)
downloadlinux-fsl-qoriq-38272d20b9e20f6c0e9a5f138dd1cb8ecdf45962.tar.xz
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c11
-rw-r--r--drivers/staging/rtl8192u/r8192U_core.c11
2 files changed, 6 insertions, 16 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 5fd6969..662c7e4 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -3150,14 +3150,9 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
goto out;
}
- param = kmalloc(p->length, GFP_KERNEL);
- if (param == NULL){
- ret = -ENOMEM;
- goto out;
- }
- if (copy_from_user(param, p->pointer, p->length)) {
- kfree(param);
- ret = -EFAULT;
+ param = memdup_user(p->pointer, p->length);
+ if (IS_ERR(param)) {
+ ret = PTR_ERR(param);
goto out;
}
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 63a4cdf..c2bcbe2 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -3789,14 +3789,9 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
goto out;
}
- ipw = kmalloc(p->length, GFP_KERNEL);
- if (ipw == NULL) {
- ret = -ENOMEM;
- goto out;
- }
- if (copy_from_user(ipw, p->pointer, p->length)) {
- kfree(ipw);
- ret = -EFAULT;
+ ipw = memdup_user(p->pointer, p->length);
+ if (IS_ERR(ipw)) {
+ ret = PTR_ERR(ipw);
goto out;
}