diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2009-12-15 19:46:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:20:01 -0500 |
commit | 2f390380ca69e1617cdddb12d8da94f0a9f4319d (patch) | |
tree | 2f60b69e62e099c43a90197c62704f099ad2169e /drivers/video/maxinefb.c | |
parent | 2cb96f86628d6e97fcbda5fe4d8d74876239834c (diff) |
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 <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/maxinefb.c')
-rw-r--r-- | drivers/video/maxinefb.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/video/maxinefb.c b/drivers/video/maxinefb.c index 5e91c2b30af9..7854c7a37dc5 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, | |||
92 | /* value to be written into the palette reg. */ | 92 | /* value to be written into the palette reg. */ |
93 | unsigned long hw_colorvalue = 0; | 93 | unsigned long hw_colorvalue = 0; |
94 | 94 | ||
95 | if (regno > 255) | ||
96 | return 1; | ||
97 | |||
95 | red >>= 8; /* The cmap fields are 16 bits */ | 98 | red >>= 8; /* The cmap fields are 16 bits */ |
96 | green >>= 8; /* wide, but the harware colormap */ | 99 | green >>= 8; /* wide, but the harware colormap */ |
97 | blue >>= 8; /* registers are only 8 bits wide */ | 100 | blue >>= 8; /* registers are only 8 bits wide */ |