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

[PATCH] intelfb: Fix buffer overrun

The pseudo_palette has room only for 16 entries, but intelfb_setcolreg will
attempt to write more.

Coverity Bug 558
Signed-off-by: NAntonino Daplas <adaplas@pol.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 8d57f221
......@@ -1333,9 +1333,7 @@ intelfb_setcolreg(unsigned regno, unsigned red, unsigned green,
if (regno > 255)
return 1;
switch (dinfo->depth) {
case 8:
{
if (dinfo->depth == 8) {
red >>= 8;
green >>= 8;
blue >>= 8;
......@@ -1343,7 +1341,9 @@ intelfb_setcolreg(unsigned regno, unsigned red, unsigned green,
intelfbhw_setcolreg(dinfo, regno, red, green, blue,
transp);
}
break;
if (regno < 16) {
switch (dinfo->depth) {
case 15:
dinfo->pseudo_palette[regno] = ((red & 0xf800) >> 1) |
((green & 0xf800) >> 6) |
......@@ -1360,6 +1360,8 @@ intelfb_setcolreg(unsigned regno, unsigned red, unsigned green,
((blue & 0xff00) >> 8);
break;
}
}
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册