* [PATCH] wil6210: use memdup_user
[not found] <df8091d4c64a0d5a7ab0a5989f34552a5eebd15e.1493778999.git.geliangtang@gmail.com>
@ 2017-05-06 15:42 ` Geliang Tang
2017-05-19 7:55 ` Kalle Valo
2017-05-06 15:42 ` [PATCH] wlcore: " Geliang Tang
1 sibling, 1 reply; 4+ messages in thread
From: Geliang Tang @ 2017-05-06 15:42 UTC (permalink / raw)
To: Maya Erez, Kalle Valo
Cc: Geliang Tang, linux-wireless, wil6210, netdev, linux-kernel
Use memdup_user() helper instead of open-coding to simplify the code.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
drivers/net/wireless/ath/wil6210/debugfs.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 5648ebb..5b0f9fc 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -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 cfg80211_mgmt_tx_params params;
int rc;
- void *frame = kmalloc(len, GFP_KERNEL);
+ void *frame;
- if (!frame)
- return -ENOMEM;
-
- if (copy_from_user(frame, buf, len)) {
- kfree(frame);
- return -EIO;
- }
+ frame = memdup_user(buf, len);
+ if (IS_ERR(frame))
+ return PTR_ERR(frame);
params.buf = frame;
params.len = len;
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] wlcore: use memdup_user
[not found] <df8091d4c64a0d5a7ab0a5989f34552a5eebd15e.1493778999.git.geliangtang@gmail.com>
2017-05-06 15:42 ` [PATCH] wil6210: use memdup_user Geliang Tang
@ 2017-05-06 15:42 ` Geliang Tang
2017-05-18 13:41 ` Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Geliang Tang @ 2017-05-06 15:42 UTC (permalink / raw)
To: Kalle Valo, Colin Ian King
Cc: Geliang Tang, linux-wireless, netdev, linux-kernel
Use memdup_user() helper instead of open-coding to simplify the code.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
drivers/net/wireless/ti/wlcore/debugfs.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c b/drivers/net/wireless/ti/wlcore/debugfs.c
index de7e2a5..a2cb408 100644
--- a/drivers/net/wireless/ti/wlcore/debugfs.c
+++ b/drivers/net/wireless/ti/wlcore/debugfs.c
@@ -1149,15 +1149,9 @@ static ssize_t dev_mem_write(struct file *file, const char __user *user_buf,
part.mem.start = *ppos;
part.mem.size = bytes;
- buf = kmalloc(bytes, GFP_KERNEL);
- if (!buf)
- return -ENOMEM;
-
- ret = copy_from_user(buf, user_buf, bytes);
- if (ret) {
- ret = -EFAULT;
- goto err_out;
- }
+ buf = memdup_user(user_buf, bytes);
+ if (IS_ERR(buf))
+ return PTR_ERR(buf);
mutex_lock(&wl->mutex);
@@ -1197,7 +1191,6 @@ static ssize_t dev_mem_write(struct file *file, const char __user *user_buf,
if (ret == 0)
*ppos += bytes;
-err_out:
kfree(buf);
return ((ret == 0) ? bytes : ret);
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: wlcore: use memdup_user
2017-05-06 15:42 ` [PATCH] wlcore: " Geliang Tang
@ 2017-05-18 13:41 ` Kalle Valo
0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2017-05-18 13:41 UTC (permalink / raw)
To: Geliang Tang
Cc: Colin Ian King, Geliang Tang, linux-wireless, netdev, linux-kernel
Geliang Tang <geliangtang@gmail.com> wrote:
> Use memdup_user() helper instead of open-coding to simplify the code.
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Patch applied to wireless-drivers-next.git, thanks.
6a01d48d47c8 wlcore: use memdup_user
--
https://patchwork.kernel.org/patch/9715005/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: wil6210: use memdup_user
2017-05-06 15:42 ` [PATCH] wil6210: use memdup_user Geliang Tang
@ 2017-05-19 7:55 ` Kalle Valo
0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2017-05-19 7:55 UTC (permalink / raw)
To: Geliang Tang
Cc: Maya Erez, Kalle Valo, Geliang Tang, linux-wireless, wil6210,
netdev, linux-kernel
Geliang Tang <geliangtang@gmail.com> wrote:
> Use memdup_user() helper instead of open-coding to simplify the code.
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Patch applied to ath-next branch of ath.git, thanks.
9a49290919e1 wil6210: use memdup_user
--
https://patchwork.kernel.org/patch/9715009/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-19 7:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <df8091d4c64a0d5a7ab0a5989f34552a5eebd15e.1493778999.git.geliangtang@gmail.com>
2017-05-06 15:42 ` [PATCH] wil6210: use memdup_user Geliang Tang
2017-05-19 7:55 ` Kalle Valo
2017-05-06 15:42 ` [PATCH] wlcore: " Geliang Tang
2017-05-18 13:41 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).