Re: [PATCH] fbdev: don't allow to set a video mode via vga= if FBdoesn't support it

From: Krzysztof Helt
Date: Mon Sep 22 2008 - 15:50:23 EST


On Sun, 21 Sep 2008 23:02:19 +0200
Michal Januszewski <spock@xxxxxxxxxx> wrote:

> From: Michal Januszewski <spock@xxxxxxxxxx>
>
> Currently, it is possible to set a VESA graphics mode at boot time via
> the vga= parameter even when no framebuffer driver supporting this is
> configured. This could lead to the system booting with a black screen,
> without a usable console.
>

Right.

> ---
> diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c
> index 401ad99..32a6045 100644
> --- a/arch/x86/boot/video-vesa.c
> +++ b/arch/x86/boot/video-vesa.c
> @@ -134,9 +131,13 @@ static int vesa_set_mode(struct mode_info *mode)
> /* It's a supported text mode */
> is_graphic = 0;
> } else if ((vminfo.mode_attr & 0x99) == 0x99) {
> +#if FB_SUPPORTS_BOOT_VESA
> /* It's a graphics mode with linear frame buffer */
> is_graphic = 1;
> vesa_mode |= 0x4000; /* Request linear frame buffer */
> +#else
> + return -1;
> +#endif
> } else {
> return -1; /* Invalid mode */
> }


This one could be simpler:

/* It's a supported text mode */
is_graphic = 0;
+#if FB_SUPPORTS_BOOT_VESA
} else if ((vminfo.mode_attr & 0x99) == 0x99) {
/* It's a graphics mode with linear frame buffer */
is_graphic = 1;
vesa_mode |= 0x4000; /* Request linear frame buffer */
+#endif
} else {
return -1; /* Invalid mode */
}


Other than this, the patch is fine to me.

Acked-by: Krzysztof Helt <krzysztof.h1@xxxxx>

Regards,
Krzysztof

----------------------------------------------------------------------
Kredyt Hipoteczny w Banku Millennium - zdobywca Zlotego Lauru Klienta!
Sprawdz >> http://link.interia.pl/f1f15

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/