Skip to content

Commit

Permalink
[PATCH] fbcon: Fix big-endian bogosity in slow_imageblit()
Browse files Browse the repository at this point in the history
The monochrome->color expansion routine that handles bitmaps which have
(widths % 8) != 0 (slow_imageblit) produces corrupt characters in big-endian.
This is caused by a bogus bit test in slow_imageblit().

Fix.

This patch may deserve to go to the stable tree.  The code has already been
well tested in little-endian machines.  It's only in big-endian where there is
uncertainty and Herbert confirmed that this is the correct way to go.

It should not introduce regressions.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Antonino A. Daplas authored and Linus Torvalds committed Mar 31, 2006
1 parent 2cbbb3b commit a536093
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/video/cfbimgblt.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *

while (j--) {
l--;
color = (*s & 1 << (FB_BIT_NR(l))) ? fgcolor : bgcolor;
color = (*s & (1 << l)) ? fgcolor : bgcolor;
val |= FB_SHIFT_HIGH(color, shift);

/* Did the bitshift spill bits to the next long? */
Expand Down
2 changes: 0 additions & 2 deletions include/linux/fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -839,12 +839,10 @@ struct fb_info {
#define FB_LEFT_POS(bpp) (32 - bpp)
#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits))
#define FB_SHIFT_LOW(val, bits) ((val) << (bits))
#define FB_BIT_NR(b) (7 - (b))
#else
#define FB_LEFT_POS(bpp) (0)
#define FB_SHIFT_HIGH(val, bits) ((val) << (bits))
#define FB_SHIFT_LOW(val, bits) ((val) >> (bits))
#define FB_BIT_NR(b) (b)
#endif

/*
Expand Down

0 comments on commit a536093

Please sign in to comment.