diff options
| author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-06-30 11:58:40 +0200 |
|---|---|---|
| committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-06-30 11:58:40 +0200 |
| commit | dab539cd14726de15932b0310532212f8da29bf7 (patch) | |
| tree | 06b244f3bebb90164c7949e682a67d380e85d08b /rc | |
| parent | 6c7829092e71b407f16ff7229a19864439170761 (diff) | |
| download | plan9front-dab539cd14726de15932b0310532212f8da29bf7.tar.xz | |
vga/igfx: fix integer overflow in datam calculation (from qu7uux)
data[mn] and link[mn] are 24-bit values.
in the expression 'm = (n * ((freq * bpp)/8)) / (lsclk * lanes)',
uvlongs are used to prevent integer overflow, but since freq, bpp, lsclk and
lanes are all ints, the cast to uvlong does not happen until it's too late,
getting a wrong value.
instead, use u32int for m and n, and use casts where necessary.
example of bad calculation:
freq = 141400000
lsclk = 270000000
lanes = 2
bpp = 18
→ 0x7f3ee1ca6 (correct value: 0x4b69d0)
Diffstat (limited to 'rc')
0 files changed, 0 insertions, 0 deletions
