Commit 1e7a04730426a96110989ed9c2bafb0d66ec2428
Committed by
Simon Glass
1 parent
a2eb65fcad
Exists in
v2017.01-smarct4x
and in
33 other branches
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; |