提交 973d9ab2 编写于 作者: A Antonino A. Daplas 提交者: Linus Torvalds

tridentfb: fix pseudo_palette array overrun in setcolreg

The pseudo_palette has only 16 elements. Do not write if regno (the array
index) is more than 15.
Signed-off-by: NAntonino Daplas <adaplas@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 eb3daa83
......@@ -976,7 +976,7 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green,
return 1;
if (bpp==8) {
if (bpp == 8) {
t_outb(0xFF,0x3C6);
t_outb(regno,0x3C8);
......@@ -984,7 +984,8 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green,
t_outb(green>>10,0x3C9);
t_outb(blue>>10,0x3C9);
} else if (bpp == 16) { /* RGB 565 */
} else if (regno < 16) {
if (bpp == 16) { /* RGB 565 */
u32 col;
col = (red & 0xF800) | ((green & 0xFC00) >> 5) |
......@@ -997,6 +998,7 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green,
((red & 0xFF00) << 8) |
((green & 0xFF00)) |
((blue & 0xFF00)>>8);
}
// debug("exit\n");
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册