fbdev: atafb - add palette register check

Add check if palette register number is in correct range
for few drivers which miss it. The regno value comes
indirectly from user space.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
Krzysztof Helt 2009-10-24 17:18:23 +02:00 committed by Geert Uytterhoeven
parent 87fbaf6aea
commit 8546e3ce6e

View file

@ -2242,6 +2242,9 @@ static int ext_setcolreg(unsigned int regno, unsigned int red,
if (!external_vgaiobase) if (!external_vgaiobase)
return 1; return 1;
if (regno > 255)
return 1;
switch (external_card_type) { switch (external_card_type) {
case IS_VGA: case IS_VGA:
OUTB(0x3c8, regno); OUTB(0x3c8, regno);