Skip to content

Commit aee50bd

Browse files
DanCh2020hdeller
authored andcommitted
fbdev: sm501fb: Add some geometry checks.
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]>
1 parent 3e41182 commit aee50bd

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
@@ -327,6 +327,13 @@ static int sm501fb_check_var(struct fb_var_screeninfo *var,
327327
if (var->xres_virtual > 4096 || var->yres_virtual > 2048)
328328
return -EINVAL;
329329

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

332339
if (var->bits_per_pixel <= 8)

0 commit comments

Comments
 (0)