diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-04-25 10:23:52 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:57:58 -0400 |
commit | 474675ad8006834be996c046b47436d8ca7a5105 (patch) | |
tree | 556cfac9c0f4e5f345e847952802f5348cb1d3f0 /drivers/media/video/videobuf-dma-sg.c | |
parent | e4dac289f01da80d7966a123bc1ea97be199ba4f (diff) |
V4L/DVB: videobuf-dma-sg: Avoid using a wrong size
drivers/media/video/videobuf-dma-sg.c: In function ‘__videobuf_mmap_mapper’:
drivers/media/video/videobuf-dma-sg.c:557: warning: ‘size’ may be used uninitialized in this function
The condition where size is floating should never happen, due to the paranoia check,
but a future change at the logic might break it. So, let's just set size to zero and
use it for the paranoia check.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/videobuf-dma-sg.c')
-rw-r--r-- | drivers/media/video/videobuf-dma-sg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 1a7f3d3d2f9..f733833a021 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -554,7 +554,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
554 | { | 554 | { |
555 | struct videobuf_dma_sg_memory *mem = buf->priv; | 555 | struct videobuf_dma_sg_memory *mem = buf->priv; |
556 | struct videobuf_mapping *map; | 556 | struct videobuf_mapping *map; |
557 | unsigned int first, last, size, i; | 557 | unsigned int first, last, size = 0, i; |
558 | int retval; | 558 | int retval; |
559 | 559 | ||
560 | retval = -EINVAL; | 560 | retval = -EINVAL; |
@@ -579,7 +579,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
579 | } | 579 | } |
580 | 580 | ||
581 | /* paranoia, should never happen since buf is always valid. */ | 581 | /* paranoia, should never happen since buf is always valid. */ |
582 | if (VIDEO_MAX_FRAME == first) { | 582 | if (!size) { |
583 | dprintk(1, "mmap app bug: offset invalid [offset=0x%lx]\n", | 583 | dprintk(1, "mmap app bug: offset invalid [offset=0x%lx]\n", |
584 | (vma->vm_pgoff << PAGE_SHIFT)); | 584 | (vma->vm_pgoff << PAGE_SHIFT)); |
585 | goto done; | 585 | goto done; |