fbcon: fix monochrome color value calculation
authorDavid Winn <[email protected]>
Thu, 2 Oct 2008 21:50:11 +0000 (14:50 -0700)
committerLinus Torvalds <[email protected]>
Thu, 2 Oct 2008 22:53:13 +0000 (15:53 -0700)
Commit 22af89aa0c0b4012a7431114a340efd3665a7617 ("fbcon: replace mono_col
macro with static inline") changed the order of operations for computing
monochrome color values.  This generates 0xffff000f instead of 0x0000000f
for a 4 bit monochrome color, leading to image corruption if it is passed
to cfb_imageblit or other similar functions.  Fix it up.

Cc: Harvey Harrison <[email protected]>
Cc: "Antonino A. Daplas" <[email protected]>
Cc: Krzysztof Helt <[email protected]>
Cc: <[email protected]> [2.6.26.x]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/video/console/fbcon.h

index a6e38e9ea73f59e3b65e7f979c9481f8004c1fc0..89a346880ec014897f051168013d4af7fc5cd091 100644 (file)
@@ -110,7 +110,7 @@ static inline int mono_col(const struct fb_info *info)
        __u32 max_len;
        max_len = max(info->var.green.length, info->var.red.length);
        max_len = max(info->var.blue.length, max_len);
-       return ~(0xfff << (max_len & 0xff));
+       return (~(0xfff << max_len)) & 0xff;
 }
 
 static inline int attr_col_ec(int shift, struct vc_data *vc,