mirror of
https://github.com/joel16/android_kernel_sony_msm8994_rework.git
synced 2025-01-08 12:41:59 +00:00
cyblafb: fix pseudo_palette array overrun in setcolreg
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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
11494543a5
commit
7592181005
@ -1068,15 +1068,18 @@ static int cyblafb_setcolreg(unsigned regno, unsigned red, unsigned green,
|
|||||||
out8(0x3C9, green >> 10);
|
out8(0x3C9, green >> 10);
|
||||||
out8(0x3C9, blue >> 10);
|
out8(0x3C9, blue >> 10);
|
||||||
|
|
||||||
} else if (bpp == 16) // RGB 565
|
} else if (regno < 16) {
|
||||||
((u32 *) info->pseudo_palette)[regno] =
|
if (bpp == 16) // RGB 565
|
||||||
(red & 0xF800) |
|
((u32 *) info->pseudo_palette)[regno] =
|
||||||
((green & 0xFC00) >> 5) | ((blue & 0xF800) >> 11);
|
(red & 0xF800) |
|
||||||
else if (bpp == 32) // ARGB 8888
|
((green & 0xFC00) >> 5) |
|
||||||
((u32 *) info->pseudo_palette)[regno] =
|
((blue & 0xF800) >> 11);
|
||||||
((transp & 0xFF00) << 16) |
|
else if (bpp == 32) // ARGB 8888
|
||||||
((red & 0xFF00) << 8) |
|
((u32 *) info->pseudo_palette)[regno] =
|
||||||
((green & 0xFF00)) | ((blue & 0xFF00) >> 8);
|
((transp & 0xFF00) << 16) |
|
||||||
|
((red & 0xFF00) << 8) |
|
||||||
|
((green & 0xFF00)) | ((blue & 0xFF00) >> 8);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user