Commit c9a6ffa6 authored by Teodora Baluta's avatar Teodora Baluta Committed by Greg Kroah-Hartman

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: default avatarTeodora Baluta <teobaluta@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d5f9f1e3
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment