aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
authorBrandon Philips <bphilips@suse.de>2007-10-05 15:26:27 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 23:03:20 -0400
commit49ee718ef51f4d938f80f67207e1bfa2a38897a4 (patch)
tree1f6079f64f6196e50cd9ed993fe1e3a2c8eb4331 /drivers/media/common
parentc726b65d079cafabc558616badbeead442e2b114 (diff)
V4L/DVB (6305): V4L: videobuf-core.c avoid NULL dereferences in videobuf-core
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 'drivers/media/common')
-rw-r--r--drivers/media/common/saa7146_video.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index 29dbc602a484..f245a3b2ef47 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -1212,6 +1212,8 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1212 mutex_unlock(&q->lock); 1212 mutex_unlock(&q->lock);
1213 return err; 1213 return err;
1214 } 1214 }
1215
1216 gbuffers = err;
1215 memset(mbuf,0,sizeof(*mbuf)); 1217 memset(mbuf,0,sizeof(*mbuf));
1216 mbuf->frames = gbuffers; 1218 mbuf->frames = gbuffers;
1217 mbuf->size = gbuffers * gbufsize; 1219 mbuf->size = gbuffers * gbufsize;