linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vivid: set min width/height to a value > 0
@ 2018-10-29 17:32 Hans Verkuil
  0 siblings, 0 replies; only message in thread
From: Hans Verkuil @ 2018-10-29 17:32 UTC (permalink / raw)
  To: Linux Media Mailing List

The capture DV timings capabilities allowed for a minimum width and height of 0.
So passing a timings struct with 0 values is allowed and will later cause a division
by zero.

Ensure that the width and height must be >= 16 to avoid this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: syzbot+57c3d83d71187054d56f@syzkaller.appspotmail.com
---
diff --git a/drivers/media/platform/vivid/vivid-vid-common.c b/drivers/media/platform/vivid/vivid-vid-common.c
index 27a0000a5973..e108e9befb77 100644
--- a/drivers/media/platform/vivid/vivid-vid-common.c
+++ b/drivers/media/platform/vivid/vivid-vid-common.c
@@ -21,7 +21,7 @@ const struct v4l2_dv_timings_cap vivid_dv_timings_cap = {
 	.type = V4L2_DV_BT_656_1120,
 	/* keep this initialization for compatibility with GCC < 4.4.6 */
 	.reserved = { 0 },
-	V4L2_INIT_BT_TIMINGS(0, MAX_WIDTH, 0, MAX_HEIGHT, 14000000, 775000000,
+	V4L2_INIT_BT_TIMINGS(16, MAX_WIDTH, 16, MAX_HEIGHT, 14000000, 775000000,
 		V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT |
 		V4L2_DV_BT_STD_CVT | V4L2_DV_BT_STD_GTF,
 		V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_INTERLACED)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-30  2:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-29 17:32 [PATCH] vivid: set min width/height to a value > 0 Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).