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>
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;