diff options
| author | Animesh Kishore <animeshk@codeaurora.org> | 2018-03-28 00:53:31 +0530 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-09-24 21:30:51 -0700 |
| commit | b7f83f8788c460c2c31c6d8ccc4907b621ead846 (patch) | |
| tree | e99d2040a483e3aaad8c0679c030fe31b5c0ca6c /drivers/video/fbdev | |
| parent | aa0ebdfe2d12829d8ee6dde5e841e1c67c9141c2 (diff) | |
mdss: mdp: Fix fudge factor overflow check
Fudge adjustment is always 64 bit operation
irrespective of underlying architecture is
32/64 bit. Fix max value to compare overflow
against. Add warning if adjustments can't go
through without overflow.
Change-Id: I9c15ea8c1754c9ddb997546dc476bb6d45198524
Signed-off-by: Animesh Kishore <animeshk@codeaurora.org>
Diffstat (limited to 'drivers/video/fbdev')
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_ctl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp_ctl.c b/drivers/video/fbdev/msm/mdss_mdp_ctl.c index ec56bcf6e64e..8cbe32940887 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_ctl.c +++ b/drivers/video/fbdev/msm/mdss_mdp_ctl.c @@ -77,13 +77,15 @@ static inline u64 fudge_factor(u64 val, u32 numer, u32 denom) u64 result = val; if (val) { - u64 temp = -1UL; + u64 temp = U64_MAX; do_div(temp, val); if (temp > numer) { /* no overflow, so we can do the operation*/ result = (val * (u64)numer); do_div(result, denom); + } else { + pr_warn("Overflow, skip fudge factor\n"); } } return result; |
