Skip to content

Commit 238ece4

Browse files
DanCh2020gregkh
authored andcommitted
fbdev: sm501fb: Add some geometry checks.
[ Upstream commit aee50bd ] 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: 5fc404e ("[PATCH] fb: SM501 framebuffer driver") Signed-off-by: Danila Chernetsov <[email protected]> Signed-off-by: Helge Deller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 8356f45 commit 238ece4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/video/fbdev/sm501fb.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@ static int sm501fb_check_var(struct fb_var_screeninfo *var,
326326
if (var->xres_virtual > 4096 || var->yres_virtual > 2048)
327327
return -EINVAL;
328328

329+
/* geometry sanity checks */
330+
if (var->xres + var->xoffset > var->xres_virtual)
331+
return -EINVAL;
332+
333+
if (var->yres + var->yoffset > var->yres_virtual)
334+
return -EINVAL;
335+
329336
/* can cope with 8,16 or 32bpp */
330337

331338
if (var->bits_per_pixel <= 8)

0 commit comments

Comments
 (0)