diff mbox

[U-Boot,2/7] x86: Sanity test on vesa parameters before setting up kernel screen_info

Message ID 1438253358-25223-3-git-send-email-bmeng.cn@gmail.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng July 30, 2015, 10:49 a.m. UTC
We should not set up kernel screen_info when the vesa parameters are
insane, otherwise kernel will panic.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/pci/pci_rom.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Simon Glass July 30, 2015, 7:53 p.m. UTC | #1
On 30 July 2015 at 04:49, Bin Meng <bmeng.cn@gmail.com> wrote:
> We should not set up kernel screen_info when the vesa parameters are
> insane, otherwise kernel will panic.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/pci/pci_rom.c | 4 ++++
>  1 file changed, 4 insertions(+)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Aug. 2, 2015, 11:36 p.m. UTC | #2
On 30 July 2015 at 13:53, Simon Glass <sjg@chromium.org> wrote:
> On 30 July 2015 at 04:49, Bin Meng <bmeng.cn@gmail.com> wrote:
>> We should not set up kernel screen_info when the vesa parameters are
>> insane, otherwise kernel will panic.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  drivers/pci/pci_rom.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c
index a33efae..26db3ca 100644
--- a/drivers/pci/pci_rom.c
+++ b/drivers/pci/pci_rom.c
@@ -235,6 +235,10 @@  void setup_video(struct screen_info *screen_info)
 #ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
 	struct vesa_mode_info *vesa = &mode_info.vesa;
 
+	/* Sanity test on VESA parameters */
+	if (!vesa->x_resolution || !vesa->y_resolution)
+		return;
+
 	screen_info->orig_video_isVGA = VIDEO_TYPE_VLFB;
 
 	screen_info->lfb_width = vesa->x_resolution;