Commit 9a492909 authored by Geliang Tang's avatar Geliang Tang Committed by Kalle Valo

wil6210: use memdup_user

Use memdup_user() helper instead of open-coding to simplify the code.
Signed-off-by: default avatarGeliang Tang <geliangtang@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 8fed6823
...@@ -795,15 +795,11 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf, ...@@ -795,15 +795,11 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
struct wireless_dev *wdev = wil_to_wdev(wil); struct wireless_dev *wdev = wil_to_wdev(wil);
struct cfg80211_mgmt_tx_params params; struct cfg80211_mgmt_tx_params params;
int rc; int rc;
void *frame = kmalloc(len, GFP_KERNEL); void *frame;
if (!frame) frame = memdup_user(buf, len);
return -ENOMEM; if (IS_ERR(frame))
return PTR_ERR(frame);
if (copy_from_user(frame, buf, len)) {
kfree(frame);
return -EIO;
}
params.buf = frame; params.buf = frame;
params.len = len; params.len = len;
......
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