summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWen Yang <wen.yang99@zte.com.cn>2018-12-06 13:29:10 +0100
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-12-07 15:42:18 +0100
commit0f4bb10857e22a657e6c8cca5d1d54b641e94628 (patch)
treef586586162695a37e2dba3399503119c5cfa3005 /drivers
parentmedia: rockchip vpu: remove some unused vars (diff)
downloadlinux-0f4bb10857e22a657e6c8cca5d1d54b641e94628.tar.xz
linux-0f4bb10857e22a657e6c8cca5d1d54b641e94628.zip
media: siano: Use kmemdup instead of duplicating its function
kmemdup has implemented the function that kmalloc() + memcpy(). We prefer to kmemdup rather than code opened implementation. This issue was detected with the help of coccinelle. Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> CC: Tomoki Sekiyama <tomoki.sekiyama@gmail.com> CC: linux-kernel@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/usb/siano/smsusb.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c
index be3634407f1f..2ffded08407b 100644
--- a/drivers/media/usb/siano/smsusb.c
+++ b/drivers/media/usb/siano/smsusb.c
@@ -225,10 +225,9 @@ static int smsusb_sendrequest(void *context, void *buffer, size_t size)
return -ENOENT;
}
- phdr = kmalloc(size, GFP_KERNEL);
+ phdr = kmemdup(buffer, size, GFP_KERNEL);
if (!phdr)
return -ENOMEM;
- memcpy(phdr, buffer, size);
pr_debug("sending %s(%d) size: %d\n",
smscore_translate_msg(phdr->msg_type), phdr->msg_type,