Skip to content

Commit

Permalink
[VIDEO] sunxvr500fb: Fix pseudo_palette array size
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
Antonino Daplas authored and David S. Miller committed Jun 5, 2007
1 parent f2c1386 commit e7e8cc5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/video/sunxvr500.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct e3d_info {
u32 fb8_0_off;
u32 fb8_1_off;

u32 pseudo_palette[256];
u32 pseudo_palette[16];
};

static int __devinit e3d_get_props(struct e3d_info *ep)
Expand Down Expand Up @@ -126,7 +126,9 @@ static int e3d_setcolreg(unsigned regno,
blue_8 = blue >> 8;

value = (blue_8 << 24) | (green_8 << 16) | (red_8 << 8);
((u32 *)info->pseudo_palette)[regno] = value;

if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 16)
((u32 *)info->pseudo_palette)[regno] = value;


red_10 = red >> 6;
Expand Down

0 comments on commit e7e8cc5

Please sign in to comment.