mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 17:59:32 +00:00
[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>
This commit is contained in:
parent
01faa0d9c7
commit
9945cf9997
1 changed files with 1 additions and 3 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue