diff options
author | Teodora Baluta <teobaluta@gmail.com> | 2013-10-25 12:00:14 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-28 14:34:42 -0700 |
commit | c9a6ffa6c09c744a5f2521aa96eebf0557365893 (patch) | |
tree | e863a1b95d2ff294d6ba5a5f98bde2c940f150e3 /drivers/staging/rtl8187se | |
parent | d5f9f1e3a9945198be1bf20f0e110af9e29f9970 (diff) | |
download | linux-c9a6ffa6c09c744a5f2521aa96eebf0557365893.tar.bz2 |
staging: rtl8187se: use memdup_user to simplify code
This patch fixes the following coccinelle warning to use memdup_user
rather than duplicating its implementation:
drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c:2947: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/staging/rtl8187se')
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index 04058263398e..029070603f66 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -2944,14 +2944,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; } |