From 2f390380ca69e1617cdddb12d8da94f0a9f4319d Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Tue, 15 Dec 2009 16:46:25 -0800 Subject: fbdev: add palette register check to several drivers Add check if palette register number is in correct range for few drivers which miss it. The regno value comes indirectly from user space. Two drivers has converted check from BUG_ON() macro to just return an error (non-zero value). Signed-off-by: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/maxinefb.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/video/maxinefb.c') diff --git a/drivers/video/maxinefb.c b/drivers/video/maxinefb.c index 5e91c2b30af..7854c7a37dc 100644 --- a/drivers/video/maxinefb.c +++ b/drivers/video/maxinefb.c @@ -92,6 +92,9 @@ static int maxinefb_setcolreg(unsigned regno, unsigned red, unsigned green, /* value to be written into the palette reg. */ unsigned long hw_colorvalue = 0; + if (regno > 255) + return 1; + red >>= 8; /* The cmap fields are 16 bits */ green >>= 8; /* wide, but the harware colormap */ blue >>= 8; /* registers are only 8 bits wide */ -- cgit v1.2.3