diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2007-07-17 07:05:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 13:23:13 -0400 |
commit | 000d5335c6e7f5dbcd849b62b4be7ae005aa6974 (patch) | |
tree | af6894791cc9fbd7dd38ac2ec0026be0f1a75a42 /drivers/video | |
parent | c312f97df65bf38a8e7f664b76154639f593775d (diff) |
sisfb: fix pseudo_palette array size and overrun
- the pseudo_palette is only 16 elements long.
- do not write to the pseudo_palette if regno (array index) is more than 15.
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/sis/sis.h | 2 | ||||
-rw-r--r-- | drivers/video/sis/sis_main.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/video/sis/sis.h b/drivers/video/sis/sis.h index d5e2d9c27847..d53bf6945f0c 100644 --- a/drivers/video/sis/sis.h +++ b/drivers/video/sis/sis.h | |||
@@ -479,7 +479,7 @@ struct sis_video_info { | |||
479 | struct fb_var_screeninfo default_var; | 479 | struct fb_var_screeninfo default_var; |
480 | 480 | ||
481 | struct fb_fix_screeninfo sisfb_fix; | 481 | struct fb_fix_screeninfo sisfb_fix; |
482 | u32 pseudo_palette[17]; | 482 | u32 pseudo_palette[16]; |
483 | 483 | ||
484 | struct sisfb_monitor { | 484 | struct sisfb_monitor { |
485 | u16 hmin; | 485 | u16 hmin; |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index 93d07ef85276..e8ccace01252 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -1405,12 +1405,18 @@ sisfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, | |||
1405 | } | 1405 | } |
1406 | break; | 1406 | break; |
1407 | case 16: | 1407 | case 16: |
1408 | if (regno >= 16) | ||
1409 | break; | ||
1410 | |||
1408 | ((u32 *)(info->pseudo_palette))[regno] = | 1411 | ((u32 *)(info->pseudo_palette))[regno] = |
1409 | (red & 0xf800) | | 1412 | (red & 0xf800) | |
1410 | ((green & 0xfc00) >> 5) | | 1413 | ((green & 0xfc00) >> 5) | |
1411 | ((blue & 0xf800) >> 11); | 1414 | ((blue & 0xf800) >> 11); |
1412 | break; | 1415 | break; |
1413 | case 32: | 1416 | case 32: |
1417 | if (regno >= 16) | ||
1418 | break; | ||
1419 | |||
1414 | red >>= 8; | 1420 | red >>= 8; |
1415 | green >>= 8; | 1421 | green >>= 8; |
1416 | blue >>= 8; | 1422 | blue >>= 8; |