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/pmag-ba-fb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/video/pmag-ba-fb.c') diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c index 0573ec685a57..0f361b6100d2 100644 --- a/drivers/video/pmag-ba-fb.c +++ b/drivers/video/pmag-ba-fb.c @@ -98,7 +98,8 @@ static int pmagbafb_setcolreg(unsigned int regno, unsigned int red, { struct pmagbafb_par *par = info->par; - BUG_ON(regno >= info->cmap.len); + if (regno >= info->cmap.len) + return 1; red >>= 8; /* The cmap fields are 16 bits */ green >>= 8; /* wide, but the hardware colormap */ -- cgit v1.2.3