Commit ee713059 authored by Antonino A. Daplas's avatar Antonino A. Daplas Committed by Linus Torvalds

[PATCH] Fix pseudo_palette setup in asiliantfb_setcolreg()

The setcolreg function will attempt to write 24 color entries to the
pseudo_pallette.  However, the pseudo_palette has only space for 16 entries.

Thanks to Atsushi Nemoto for reporting this bug.
Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent cacfc8cf
...@@ -322,32 +322,29 @@ static int asiliantfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, ...@@ -322,32 +322,29 @@ static int asiliantfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
writeb(green, mmio_base + 0x791); writeb(green, mmio_base + 0x791);
writeb(blue, mmio_base + 0x791); writeb(blue, mmio_base + 0x791);
switch(p->var.bits_per_pixel) {
case 15:
if (regno < 16) { if (regno < 16) {
switch(p->var.red.offset) {
case 10: /* RGB 555 */
((u32 *)(p->pseudo_palette))[regno] = ((u32 *)(p->pseudo_palette))[regno] =
((red & 0xf8) << 7) | ((red & 0xf8) << 7) |
((green & 0xf8) << 2) | ((green & 0xf8) << 2) |
((blue & 0xf8) >> 3); ((blue & 0xf8) >> 3);
}
break; break;
case 16: case 11: /* RGB 565 */
if (regno < 16) {
((u32 *)(p->pseudo_palette))[regno] = ((u32 *)(p->pseudo_palette))[regno] =
((red & 0xf8) << 8) | ((red & 0xf8) << 8) |
((green & 0xfc) << 3) | ((green & 0xfc) << 3) |
((blue & 0xf8) >> 3); ((blue & 0xf8) >> 3);
}
break; break;
case 24: case 16: /* RGB 888 */
if (regno < 24) {
((u32 *)(p->pseudo_palette))[regno] = ((u32 *)(p->pseudo_palette))[regno] =
(red << 16) | (red << 16) |
(green << 8) | (green << 8) |
(blue); (blue);
}
break; break;
} }
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment