[PATCH] fbcon: Console Rotation - Fix wrong shift calculation

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>

authored by Antonino A. Daplas and committed by Linus Torvalds b4627dea 74a8a65c

+2 -2
+2 -2
drivers/video/console/fbcon_rotate.h
··· 49 static inline void rotate_ud(const char *in, char *out, u32 width, u32 height) 50 { 51 int i, j; 52 - int shift = width % 8; 53 54 width = (width + 7) & ~7; 55 ··· 85 static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height) 86 { 87 int i, j, h = height, w = width; 88 - int shift = width % 8; 89 90 width = (width + 7) & ~7; 91 height = (height + 7) & ~7;
··· 49 static inline void rotate_ud(const char *in, char *out, u32 width, u32 height) 50 { 51 int i, j; 52 + int shift = (8 - (width % 8)) & 7; 53 54 width = (width + 7) & ~7; 55 ··· 85 static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height) 86 { 87 int i, j, h = height, w = width; 88 + int shift = (8 - (width % 8)) & 7; 89 90 width = (width + 7) & ~7; 91 height = (height + 7) & ~7;