mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-06 03:45:24 -04:00
fbdev: sm501fb: Add some geometry checks.
[ Upstream commit aee50bd88ea5fde1ff4cc021385598f81a65830c ]
Added checks for xoffset, yoffset settings.
Incorrect settings of these parameters can lead to errors
in sm501fb_pan_ functions.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 5fc404e47b ("[PATCH] fb: SM501 framebuffer driver")
Signed-off-by: Danila Chernetsov <listdansp@mail.ru>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
38b9a21a75
commit
90ab169fb9
1 changed files with 7 additions and 0 deletions
|
|
@ -326,6 +326,13 @@ static int sm501fb_check_var(struct fb_var_screeninfo *var,
|
|||
if (var->xres_virtual > 4096 || var->yres_virtual > 2048)
|
||||
return -EINVAL;
|
||||
|
||||
/* geometry sanity checks */
|
||||
if (var->xres + var->xoffset > var->xres_virtual)
|
||||
return -EINVAL;
|
||||
|
||||
if (var->yres + var->yoffset > var->yres_virtual)
|
||||
return -EINVAL;
|
||||
|
||||
/* can cope with 8,16 or 32bpp */
|
||||
|
||||
if (var->bits_per_pixel <= 8)
|
||||
|
|
|
|||
Loading…
Reference in a new issue