From: sayli karnik Date: Sun, 16 Oct 2016 08:49:48 +0000 (+0530) Subject: staging: greybus: es2: Use kmemdup instead of kmalloc and memcpy X-Git-Tag: v4.14-rc1~1919^2~525 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9edae49285051dc9312392df0d07c85f236a4d4b;p=platform%2Fkernel%2Flinux-rpi3.git 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 --- 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,