Skip to content

upower: Prevent integer overflow during new brightness computation

ivan tkachenko requested to merge work/ratijas/shine-on-you-crazy-diamond into master

Provably, if two integers can fit in 31 bits each, the result of their multiplication is expressible in 62 bits (let alone 63 available). So, this should be safe. And the division can't do much harm: the divisor is always at least 1, and worst case scenario — it would be so big that the overall results becomes zero.

BUG: 454161

Merge request reports

Loading