From 9edae49285051dc9312392df0d07c85f236a4d4b Mon Sep 17 00:00:00 2001 From: sayli karnik Date: Sun, 16 Oct 2016 14:19:48 +0530 Subject: [PATCH] staging: greybus: es2: Use kmemdup instead of kmalloc and memcpy This patch replaces kmalloc and memcpy with kmemdup for duplication of memory. Signed-off-by: sayli karnik Signed-off-by: Greg Kroah-Hartman --- 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 071bb1cfd3ae..8eabc713a26d 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,