From: Thomas Meyer Date: Sat, 1 Jun 2013 08:38:30 +0000 (-0300) Subject: [media] pvrusb2: Cocci spatch "memdup.spatch" X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=07342664d3725de4b21478da222593da491afcd8;p=linux-beck.git [media] pvrusb2: Cocci spatch "memdup.spatch" Signed-off-by: Thomas Meyer Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/usb/pvrusb2/pvrusb2-io.c b/drivers/media/usb/pvrusb2/pvrusb2-io.c index 20b6ae0bb40d..1e354747de3f 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-io.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-io.c @@ -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;