提交 f2c13863 编写于 作者: A Antonino Daplas 提交者: David S. Miller

[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: NAntonino Daplas <adaplas@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d2fa9e05
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册