fbdev: atafb - add palette register check
authorKrzysztof Helt <krzysztof.h1@wp.pl>
Sat, 24 Oct 2009 15:18:23 +0000 (17:18 +0200)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Sun, 6 Dec 2009 10:18:27 +0000 (11:18 +0100)
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>
drivers/video/atafb.c

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