All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] atmel: use memdup_user to simplify the code
@ 2018-06-04 10:32 YueHaibing
  2018-06-27 16:06 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2018-06-04 10:32 UTC (permalink / raw)
  To: davem, kvalo; +Cc: netdev, linux-kernel, linux-wireless, YueHaibing

use existing memdup_user() helper function instead of open-coding

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/wireless/atmel/atmel.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c
index d122386..30b479a 100644
--- a/drivers/net/wireless/atmel/atmel.c
+++ b/drivers/net/wireless/atmel/atmel.c
@@ -2657,14 +2657,9 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 			break;
 		}
 
-		if (!(new_firmware = kmalloc(com.len, GFP_KERNEL))) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(new_firmware, com.data, com.len)) {
-			kfree(new_firmware);
-			rc = -EFAULT;
+		new_firmware = memdup_user(com.data, com.len);
+		if (IS_ERR(new_firmware)) {
+			rc = PTR_ERR(new_firmware);
 			break;
 		}
 
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: atmel: use memdup_user to simplify the code
  2018-06-04 10:32 [PATCH] atmel: use memdup_user to simplify the code YueHaibing
@ 2018-06-27 16:06 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2018-06-27 16:06 UTC (permalink / raw)
  To: YueHaibing; +Cc: davem, netdev, linux-kernel, linux-wireless, YueHaibing

YueHaibing <yuehaibing@huawei.com> wrote:

> use existing memdup_user() helper function instead of open-coding
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Patch applied to wireless-drivers-next.git, thanks.

8668f9a57c8c atmel: use memdup_user to simplify the code

-- 
https://patchwork.kernel.org/patch/10446299/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-27 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-04 10:32 [PATCH] atmel: use memdup_user to simplify the code YueHaibing
2018-06-27 16:06 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.