This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-dvb.git tree:

Subject: V4L/DVB: drivers/media/video/tlg2300: Use kmemdup
Author:  Julia Lawall <[email protected]>
Date:    Thu Jul 1 01:41:44 2010 -0300

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <[email protected]>
CC: Kang Yong <[email protected]>
CC: Zhang Xiaobing <[email protected]>
CC: Huang Shijie <[email protected]>
Signed-off-by: Douglas Schilling Landgraf <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/video/tlg2300/pd-main.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/v4l-dvb.git?a=commitdiff;h=e609d89c0bf5d2a37469ff43128a5070a9212db4

diff --git a/drivers/media/video/tlg2300/pd-main.c 
b/drivers/media/video/tlg2300/pd-main.c
index c267e0c..f9b5d3d 100644
--- a/drivers/media/video/tlg2300/pd-main.c
+++ b/drivers/media/video/tlg2300/pd-main.c
@@ -227,12 +227,11 @@ static int firmware_download(struct usb_device *udev)
 
        fwlength = fw->size;
 
-       fwbuf = kzalloc(fwlength, GFP_KERNEL);
+       fwbuf = kmemdup(fw->data, fwlength, GFP_KERNEL);
        if (!fwbuf) {
                ret = -ENOMEM;
                goto out;
        }
-       memcpy(fwbuf, fw->data, fwlength);
 
        max_packet_size = udev->ep_out[0x1]->desc.wMaxPacketSize;
        log("\t\t download size : %d", (int)max_packet_size);

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to