Skip to content

Commit

Permalink
[PATCH] fbcon: Console Rotation - Fix wrong shift calculation
Browse files Browse the repository at this point in the history
The shift value (amount to shift the bitmap so first pixel starts at
origin(0,0)) is incorrect.  This causes corrupted characters or a kernel crash
if fontwidth is not divisible by 8 at 270 degrees, or fontheight not divisible
by 8 at 180 degrees.

Report and part of the fix contributed by Knut Petersen.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
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 Nov 22, 2005
1 parent 74a8a65 commit b4627de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/video/console/fbcon_rotate.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static inline void pattern_set_bit(u32 x, u32 y, u32 pitch, char *pat)
static inline void rotate_ud(const char *in, char *out, u32 width, u32 height)
{
int i, j;
int shift = width % 8;
int shift = (8 - (width % 8)) & 7;

width = (width + 7) & ~7;

Expand Down Expand Up @@ -85,7 +85,7 @@ static inline void rotate_cw(const char *in, char *out, u32 width, u32 height)
static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height)
{
int i, j, h = height, w = width;
int shift = width % 8;
int shift = (8 - (width % 8)) & 7;

width = (width + 7) & ~7;
height = (height + 7) & ~7;
Expand Down

0 comments on commit b4627de

Please sign in to comment.