diff options
author | Antonino Daplas <adaplas@gmail.com> | 2007-06-05 16:15:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-06-05 16:15:01 -0400 |
commit | f2c138638687a7ffbf0d2a0e7addfec7bab9a765 (patch) | |
tree | a85ed4f1ef83a0bbdceadc59bab139c3a480f89f /drivers/video/sunxvr2500.c | |
parent | d2fa9e05e3876198d8ab31624fe84512a0a44b45 (diff) |
[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/video/sunxvr2500.c')
-rw-r--r-- | drivers/video/sunxvr2500.c | 17 |
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 { | |||
28 | unsigned int depth; | 28 | unsigned int depth; |
29 | unsigned int fb_size; | 29 | unsigned int fb_size; |
30 | 30 | ||
31 | u32 pseudo_palette[256]; | 31 | u32 pseudo_palette[16]; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static int __devinit s3d_get_props(struct s3d_info *sp) | 34 | static int __devinit s3d_get_props(struct s3d_info *sp) |
@@ -52,15 +52,14 @@ static int s3d_setcolreg(unsigned regno, | |||
52 | { | 52 | { |
53 | u32 value; | 53 | u32 value; |
54 | 54 | ||
55 | if (regno >= 256) | 55 | if (regno < 16) { |
56 | return 1; | 56 | red >>= 8; |
57 | green >>= 8; | ||
58 | blue >>= 8; | ||
57 | 59 | ||
58 | red >>= 8; | 60 | value = (blue << 24) | (green << 16) | (red << 8); |
59 | green >>= 8; | 61 | ((u32 *)info->pseudo_palette)[regno] = value; |
60 | blue >>= 8; | 62 | } |
61 | |||
62 | value = (blue << 24) | (green << 16) | (red << 8); | ||
63 | ((u32 *)info->pseudo_palette)[regno] = value; | ||
64 | 63 | ||
65 | return 0; | 64 | return 0; |
66 | } | 65 | } |