summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/videobuf-vmalloc.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-12-08 18:05:53 -0800
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-12-08 18:05:53 -0800
commit114232698b624615ecd9b02f47f595edee5061e1 (patch)
tree8853141bb1b33b68e43638e205ef24a6541a7563 /linux/drivers/media/video/videobuf-vmalloc.c
parent0c09e76188a772f3abeb2c319a1a473330b25905 (diff)
downloadmediapointer-dvb-s2-114232698b624615ecd9b02f47f595edee5061e1.tar.gz
mediapointer-dvb-s2-114232698b624615ecd9b02f47f595edee5061e1.tar.bz2
V4L: Memory leak! Fix count in videobuf-vmalloc mmap
From: Brandon Philips <bphilips@suse.de> This is pretty serious bug. map->count is never initialized after the call to kmalloc making the count start at some random trash value. The end result is leaking videobufs. Also, fix up the debug statements to print unsigned values. Pushed to http://ifup.org/hg/v4l-dvb too Signed-off-by: Brandon Philips <bphilips@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/videobuf-vmalloc.c')
-rw-r--r--linux/drivers/media/video/videobuf-vmalloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/linux/drivers/media/video/videobuf-vmalloc.c b/linux/drivers/media/video/videobuf-vmalloc.c
index ceb4b54ac..84bb18565 100644
--- a/linux/drivers/media/video/videobuf-vmalloc.c
+++ b/linux/drivers/media/video/videobuf-vmalloc.c
@@ -52,7 +52,7 @@ videobuf_vm_open(struct vm_area_struct *vma)
{
struct videobuf_mapping *map = vma->vm_private_data;
- dprintk(2,"vm_open %p [count=%d,vma=%08lx-%08lx]\n",map,
+ dprintk(2,"vm_open %p [count=%u,vma=%08lx-%08lx]\n",map,
map->count,vma->vm_start,vma->vm_end);
map->count++;
@@ -65,7 +65,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
struct videobuf_queue *q = map->q;
int i;
- dprintk(2,"vm_close %p [count=%d,vma=%08lx-%08lx]\n",map,
+ dprintk(2,"vm_close %p [count=%u,vma=%08lx-%08lx]\n",map,
map->count,vma->vm_start,vma->vm_end);
map->count--;
@@ -222,7 +222,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
}
/* create mapping + update buffer list */
- map = q->bufs[first]->map = kmalloc(sizeof(struct videobuf_mapping),GFP_KERNEL);
+ map = q->bufs[first]->map = kzalloc(sizeof(struct videobuf_mapping),GFP_KERNEL);
if (NULL == map)
return -ENOMEM;