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>
This commit is contained in:

committed by
Linus Torvalds

parent
2cb96f8662
commit
2f390380ca
@@ -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 */
|
||||
|
Reference in New Issue
Block a user