aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/saa7146_video.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common/saa7146_video.c')
-rw-r--r--drivers/media/common/saa7146_video.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index a5e62750eea3..e8bc7abf2409 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -656,7 +656,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu
656 656
657 /* if we have a user buffer, the first page may not be 657 /* if we have a user buffer, the first page may not be
658 aligned to a page boundary. */ 658 aligned to a page boundary. */
659 pt1->offset = list->offset; 659 pt1->offset = dma->sglist->offset;
660 pt2->offset = pt1->offset+o1; 660 pt2->offset = pt1->offset+o1;
661 pt3->offset = pt1->offset+o2; 661 pt3->offset = pt1->offset+o2;
662 662
@@ -958,21 +958,18 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
958 case VIDIOC_ENUM_FMT: 958 case VIDIOC_ENUM_FMT:
959 { 959 {
960 struct v4l2_fmtdesc *f = arg; 960 struct v4l2_fmtdesc *f = arg;
961 int index;
962 961
963 switch (f->type) { 962 switch (f->type) {
964 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 963 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
965 case V4L2_BUF_TYPE_VIDEO_OVERLAY: { 964 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
966 index = f->index; 965 if (f->index >= NUM_FORMATS)
967 if (index < 0 || index >= NUM_FORMATS) {
968 return -EINVAL; 966 return -EINVAL;
969 } 967 strlcpy((char *)f->description, formats[f->index].name,
970 memset(f,0,sizeof(*f)); 968 sizeof(f->description));
971 f->index = index; 969 f->pixelformat = formats[f->index].pixelformat;
972 strlcpy((char *)f->description,formats[index].name,sizeof(f->description)); 970 f->flags = 0;
973 f->pixelformat = formats[index].pixelformat; 971 memset(f->reserved, 0, sizeof(f->reserved));
974 break; 972 break;
975 }
976 default: 973 default:
977 return -EINVAL; 974 return -EINVAL;
978 } 975 }