Commit 1e7a04730426a96110989ed9c2bafb0d66ec2428

Authored by Bin Meng
Committed by Simon Glass
1 parent a2eb65fcad

x86: Sanity test on vesa parameters before setting up kernel screen_info

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>
Acked-by: Simon Glass <sjg@chromium.org>

Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff

drivers/pci/pci_rom.c
... ... @@ -235,6 +235,10 @@
235 235 #ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
236 236 struct vesa_mode_info *vesa = &mode_info.vesa;
237 237  
  238 + /* Sanity test on VESA parameters */
  239 + if (!vesa->x_resolution || !vesa->y_resolution)
  240 + return;
  241 +
238 242 screen_info->orig_video_isVGA = VIDEO_TYPE_VLFB;
239 243  
240 244 screen_info->lfb_width = vesa->x_resolution;