All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: greybus: es2: Use kmemdup instead of kmalloc and memcpy
@ 2016-10-16  8:49 sayli karnik
  2016-10-17 15:19 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: sayli karnik @ 2016-10-16  8:49 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Johan Hovold, Alex Elder, Greg Kroah-Hartman

This patch replaces kmalloc and memcpy with kmemdup for duplication of
memory.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
---
 drivers/staging/greybus/es2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c
index 071bb1c..8eabc71 100644
--- a/drivers/staging/greybus/es2.c
+++ b/drivers/staging/greybus/es2.c
@@ -175,10 +175,9 @@ static int output_sync(struct es2_ap_dev *es2, void *req, u16 size, u8 cmd)
 	u8 *data;
 	int retval;
 
-	data = kmalloc(size, GFP_KERNEL);
+	data = kmemdup(req, size, GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
-	memcpy(data, req, size);
 
 	retval = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 				 cmd,
-- 
2.7.4



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

end of thread, other threads:[~2016-10-17 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-16  8:49 [PATCH] staging: greybus: es2: Use kmemdup instead of kmalloc and memcpy sayli karnik
2016-10-17 15:19 ` Johan Hovold

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.