[media] v4l2-dv-timings: fix overflow in gtf timings calculation
authorPrashant Laddha <prladdha@cisco.com>
Tue, 5 May 2015 13:16:27 +0000 (10:16 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 18 May 2015 19:27:29 +0000 (16:27 -0300)
commitc9bc9f50753d20d24836831d40e1efe74c21b0ef
tree3c2222d564c150a359f951a5f21ebc7e477a4f6e
parented1bc664daf58af7da47581fe43d42b95a1de65a
[media] v4l2-dv-timings: fix overflow in gtf timings calculation

The intermediate calculation in the expression for hblank can exceed
32 bit signed range. This overflow can lead to negative values for
hblank. Typecasting intermediate variable to higher precision.

Cc: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
[hans.verkuil@cisco.com: made the denominator u32, since that's what div_u64 expects]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/v4l2-core/v4l2-dv-timings.c