diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2007-10-16 01:29:56 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 09:43:23 -0700 |
commit | b738b990468d2acd5be7fe177fb750448bfa0b37 (patch) | |
tree | 496295879208953b67ed5e8aaa49f675c68423f2 /drivers/video/imsttfb.c | |
parent | 4d8a2d986d3ee3ece9c3cefbb23425a22132492c (diff) |
tgafb: fix an out-of-range shift in mono imageblit
The pixel mask calculation in tgafb_mono_imageblit() uses a variable
left-shift on a 32-bit data type by up to 32. Shifting by the width of a data
type or more produces an unpredictable result according to the C standard.
Rather than widening the data type this fix makes sure the count is between 0
and 31. The reason is not to penalise 32-bit platforms with operation on a
"long long" type for a marginal case that is meant not to happen (blitting an
image of a zero width).
The reason it has escaped for so long is the Alpha, being purely 64-bit, :-)
does not mask the shift out to 32 bits. This is a valid implementation --
producing the correct result certainly falls within "unpredictable behaviour".
It does trigger on MIPS though and it is the recent merge of the TC support
which only enabled the driver for use on anything other than the Alpha. For
MIPS when the width is 32 the mask ends up being 0 rather than 0xffffffff as
it should be and the frame buffer is not updated.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: Antonino Daplas <adaplas@pol.net>
Cc: Jay Estabrook <Jay.Estabrook@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/imsttfb.c')
0 files changed, 0 insertions, 0 deletions