From: Ville Syrjälä Date: Fri, 7 Jun 2019 16:26:09 +0000 (+0300) Subject: drm: Refuse to create zero width/height cmdline modes X-Git-Tag: microblaze-v5.14~4^2~11^2~15 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=19a9a0efe6391c296cba50df3797f0b167facc96;p=linux-2.6-microblaze.git drm: Refuse to create zero width/height cmdline modes If the user specifies zero width/height cmdline mode i915 will blow up as the fbdev path will bypass the regular fb sanity check that would otherwise have refused to create a framebuffer with zero width/height. The reason I thought to try this is so that I can force a specific depth for fbdev without actually having to hardcode the mode on the kernel cmdline. Eg. if I pass video=0x0-8 I will get an 8bpp framebuffer at my monitor's native resolution. Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20190607162611.23514-2-ville.syrjala@linux.intel.com Reviewed-by: Daniel Vetter --- diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 1ac67d4505e0..33a93fa24eb1 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -1864,6 +1864,9 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev, { struct drm_display_mode *mode; + if (cmd->xres == 0 || cmd->yres == 0) + return NULL; + if (cmd->cvt) mode = drm_cvt_mode(dev, cmd->xres, cmd->yres,