Skip to content

Commit 6c11df5

Browse files
committed
fbmem: Check virtual screen sizes in fb_set_var()
Verify that the fbdev or drm driver correctly adjusted the virtual screen sizes. On failure report the failing driver and reject the screen size change. Signed-off-by: Helge Deller <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Cc: [email protected] # v5.4+
1 parent e64242c commit 6c11df5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/video/fbdev/core/fbmem.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,16 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
10171017
if (ret)
10181018
return ret;
10191019

1020+
/* verify that virtual resolution >= physical resolution */
1021+
if (var->xres_virtual < var->xres ||
1022+
var->yres_virtual < var->yres) {
1023+
pr_warn("WARNING: fbcon: Driver '%s' missed to adjust virtual screen size (%ux%u vs. %ux%u)\n",
1024+
info->fix.id,
1025+
var->xres_virtual, var->yres_virtual,
1026+
var->xres, var->yres);
1027+
return -EINVAL;
1028+
}
1029+
10201030
if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW)
10211031
return 0;
10221032

0 commit comments

Comments
 (0)