[media] pvrusb2: Cocci spatch "memdup.spatch"
authorThomas Meyer <thomas@m3y3r.de>
Sat, 1 Jun 2013 08:38:30 +0000 (05:38 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 17 Jun 2013 16:17:35 +0000 (13:17 -0300)
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/pvrusb2/pvrusb2-io.c

index 20b6ae0bb40d613c89614c655ca9b7b110a5aa5f..1e354747de3f361399e4af56636d1efe8f64c714 100644 (file)
@@ -354,9 +354,9 @@ static int pvr2_stream_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
                if (scnt < sp->buffer_slot_count) {
                        struct pvr2_buffer **nb = NULL;
                        if (scnt) {
-                               nb = kmalloc(scnt * sizeof(*nb),GFP_KERNEL);
+                               nb = kmemdup(sp->buffers, scnt * sizeof(*nb),
+                                            GFP_KERNEL);
                                if (!nb) return -ENOMEM;
-                               memcpy(nb,sp->buffers,scnt * sizeof(*nb));
                        }
                        kfree(sp->buffers);
                        sp->buffers = nb;