summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/bt8xx/bttv-driver.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-10-05 12:26:27 -0700
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-05 12:26:27 -0700
commit161653daccfd120c87b56249ac18d81e05b01ddd (patch)
treebfdc332ec53e918d9ba9ec1b8407986120538991 /linux/drivers/media/video/bt8xx/bttv-driver.c
parent2c620029905d1d8a6b7a1d1861c12feaf3b4087e (diff)
downloadmediapointer-dvb-s2-161653daccfd120c87b56249ac18d81e05b01ddd.tar.gz
mediapointer-dvb-s2-161653daccfd120c87b56249ac18d81e05b01ddd.tar.bz2
V4L: videobuf-core.c avoid NULL dereferences in videobuf-core
From: Brandon Philips <bphilips@suse.de> The return value of videobuf_alloc() is unchecked but this function will return NULL on an error. Check for NULL and make videobuf_reqbufs() return the number of successfully allocated buffers. Also, fix saa7146_video.c and bttv-driver.c to use this returned buffer count. Tested against the vivi driver. Not tested against saa7146 or bt8xx devices. Signed-off-by: Brandon Philips <bphilips@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/bt8xx/bttv-driver.c')
-rw-r--r--linux/drivers/media/video/bt8xx/bttv-driver.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c
index 99cb475cd..4cc02c8e1 100644
--- a/linux/drivers/media/video/bt8xx/bttv-driver.c
+++ b/linux/drivers/media/video/bt8xx/bttv-driver.c
@@ -3113,6 +3113,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
V4L2_MEMORY_MMAP);
if (retval < 0)
goto fh_unlock_and_return;
+
+ gbuffers = retval;
memset(mbuf,0,sizeof(*mbuf));
mbuf->frames = gbuffers;
mbuf->size = gbuffers * gbufsize;