Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 5fc404e47bdf ("[PATCH] fb: SM501 framebuffer driver")
Signed-off-by: Danila Chernetsov <listdansp@mail.ru>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Danila Chernetsov and committed by
Helge Deller
aee50bd8 3e411827

+7
+7
drivers/video/fbdev/sm501fb.c
··· 327 327 if (var->xres_virtual > 4096 || var->yres_virtual > 2048) 328 328 return -EINVAL; 329 329 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 + 330 337 /* can cope with 8,16 or 32bpp */ 331 338 332 339 if (var->bits_per_pixel <= 8)