Wrong values of hfreq and image height can lead to strange timings.
Avoid timing calculations for such values.
Suggested By: Martin Bugge <marbugge@cisco.com>
Cc: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
else
return false;
+ if (hfreq == 0)
+ return false;
+
/* Vertical */
if (reduced_blanking) {
v_fp = CVT_RB_V_FPORCH;
}
image_height = (frame_height - v_fp - vsync - v_bp + 1) & ~0x1;
+ if (image_height < 0)
+ return false;
+
/* Aspect ratio based on vsync */
switch (vsync) {
case 4:
else
return false;
+ if (hfreq == 0)
+ return false;
+
/* Vertical */
v_fp = GTF_V_FP;
v_bp = (GTF_MIN_VSYNC_BP * hfreq + 500000) / 1000000 - vsync;
image_height = (frame_height - v_fp - vsync - v_bp + 1) & ~0x1;
+ if (image_height < 0)
+ return false;
+
if (aspect.numerator == 0 || aspect.denominator == 0) {
aspect.numerator = 16;
aspect.denominator = 9;