summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAntonino Daplas <adaplas@gmail.com>2007-06-06 00:15:01 +0400
committerDavid S. Miller <davem@davemloft.net>2007-06-06 00:15:01 +0400
commitf2c138638687a7ffbf0d2a0e7addfec7bab9a765 (patch)
treea85ed4f1ef83a0bbdceadc59bab139c3a480f89f /drivers
parentd2fa9e05e3876198d8ab31624fe84512a0a44b45 (diff)
downloadlinux-f2c138638687a7ffbf0d2a0e7addfec7bab9a765.tar.xz
[VIDEO] sunxvr2500fb: Fix pseudo_palette array size
- the pseudo_palette is only 16 elements long. - the pseudo_palette has only 16 elements. Do not write if regno (the array index) is more than 15. Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/sunxvr2500.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/video/sunxvr2500.c b/drivers/video/sunxvr2500.c
index 4316c7fe8e21..c3869a96ab58 100644
--- a/drivers/video/sunxvr2500.c
+++ b/drivers/video/sunxvr2500.c
@@ -28,7 +28,7 @@ struct s3d_info {
unsigned int depth;
unsigned int fb_size;
- u32 pseudo_palette[256];
+ u32 pseudo_palette[16];
};
static int __devinit s3d_get_props(struct s3d_info *sp)
@@ -52,15 +52,14 @@ static int s3d_setcolreg(unsigned regno,
{
u32 value;
- if (regno >= 256)
- return 1;
+ if (regno < 16) {
+ red >>= 8;
+ green >>= 8;
+ blue >>= 8;
- red >>= 8;
- green >>= 8;
- blue >>= 8;
-
- value = (blue << 24) | (green << 16) | (red << 8);
- ((u32 *)info->pseudo_palette)[regno] = value;
+ value = (blue << 24) | (green << 16) | (red << 8);
+ ((u32 *)info->pseudo_palette)[regno] = value;
+ }
return 0;
}