diff options
author | Shyam Saini <mayhs11saini@gmail.com> | 2016-12-23 22:34:36 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-01-31 12:46:34 +0300 |
commit | 9945cf9997b5fc10b47c010cdb40b2753ccc77d9 (patch) | |
tree | 07890aae81e61363158a1f1e85af7cf1d248edb8 /drivers/media/usb | |
parent | 01faa0d9c79e9c6a52d33e01f953588a946e3d87 (diff) | |
download | linux-9945cf9997b5fc10b47c010cdb40b2753ccc77d9.tar.xz |
[media] media: usb: cpia2: Use kmemdup instead of kmalloc and memcpy
When some other buffer is immediately copied into allocated region.
Replace calls to kmalloc followed by a memcpy with a direct
call to kmemdup.
Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r-- | drivers/media/usb/cpia2/cpia2_usb.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c index 7a50662348f6..1c7e16e5d88b 100644 --- a/drivers/media/usb/cpia2/cpia2_usb.c +++ b/drivers/media/usb/cpia2/cpia2_usb.c @@ -547,12 +547,10 @@ static int write_packet(struct usb_device *udev, if (!registers || size <= 0) return -EINVAL; - buf = kmalloc(size, GFP_KERNEL); + buf = kmemdup(registers, size, GFP_KERNEL); if (!buf) return -ENOMEM; - memcpy(buf, registers, size); - ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), request, |