Commit 474675ad authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

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: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e4dac289
...@@ -554,7 +554,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, ...@@ -554,7 +554,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
{ {
struct videobuf_dma_sg_memory *mem = buf->priv; struct videobuf_dma_sg_memory *mem = buf->priv;
struct videobuf_mapping *map; struct videobuf_mapping *map;
unsigned int first, last, size, i; unsigned int first, last, size = 0, i;
int retval; int retval;
retval = -EINVAL; retval = -EINVAL;
...@@ -579,7 +579,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, ...@@ -579,7 +579,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
} }
/* paranoia, should never happen since buf is always valid. */ /* paranoia, should never happen since buf is always valid. */
if (VIDEO_MAX_FRAME == first) { if (!size) {
dprintk(1, "mmap app bug: offset invalid [offset=0x%lx]\n", dprintk(1, "mmap app bug: offset invalid [offset=0x%lx]\n",
(vma->vm_pgoff << PAGE_SHIFT)); (vma->vm_pgoff << PAGE_SHIFT));
goto done; goto done;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment