Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] [media] pwc: Use kmemdup rather than duplicating its implementation
@ 2011-11-17 22:43 Thomas Meyer
  0 siblings, 0 replies; only message in thread
From: Thomas Meyer @ 2011-11-17 22:43 UTC (permalink / raw)
  To: mchehab, linux-media, linux-kernel

The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c
--- a/drivers/media/video/pwc/pwc-ctrl.c 2011-11-07 19:37:51.143333699 +0100
+++ b/drivers/media/video/pwc/pwc-ctrl.c 2011-11-08 10:47:00.679677247 +0100
@@ -113,10 +113,9 @@ static int _send_control_msg(struct pwc_
 	void *kbuf = NULL;
 
 	if (buflen) {
-		kbuf = kmalloc(buflen, GFP_KERNEL); /* not allowed on stack */
+		kbuf = kmemdup(buf, buflen, GFP_KERNEL); /* not allowed on stack */
 		if (kbuf == NULL)
 			return -ENOMEM;
-		memcpy(kbuf, buf, buflen);
 	}
 
 	rc = usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0),

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-18  9:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-17 22:43 [PATCH] [media] pwc: Use kmemdup rather than duplicating its implementation Thomas Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox