media: common: saa7146: check minimum video format size
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 2 Mar 2023 11:31:24 +0000 (11:31 +0000)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sat, 15 Apr 2023 07:54:09 +0000 (08:54 +0100)
There was no check for the minimum width and height, so
0 values were just passed on. Fix this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/common/saa7146/saa7146_video.c

index 8306860e9e8aabac39683e0d7a5c85968a9ef314..65045f7aa28df9eb56e1261515f921d588cc9f9f 100644 (file)
@@ -392,6 +392,10 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma
 
        f->fmt.pix.field = field;
        f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+       if (f->fmt.pix.width < 48)
+               f->fmt.pix.width = 48;
+       if (f->fmt.pix.height < 32)
+               f->fmt.pix.height = 32;
        if (f->fmt.pix.width > maxw)
                f->fmt.pix.width = maxw;
        if (f->fmt.pix.height > maxh)