libpayload: corebootfb: Add null check for framebuffer address

If the framebuffer address is zero the corebootfb_init() function
should abort and not attempt to use it for video, otherwise it
will likely hang.

This was tested by booting on a board that does not have a display
attached and includes the previous patch to zero the framebuffer
structure in the coreboot tables.

Change-Id: I53ca2e947a7915cebb31b51e11ac6c310d9d6c55
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://review.coreboot.org/20368
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Duncan Laurie 2017-06-26 01:38:00 -07:00
parent 13bc5e5c80
commit 98409cff92
1 changed files with 2 additions and 0 deletions

View File

@ -237,6 +237,8 @@ static int corebootfb_init(void)
fbinfo = virt_to_phys(lib_sysinfo.framebuffer); fbinfo = virt_to_phys(lib_sysinfo.framebuffer);
fbaddr = FI->physical_address; fbaddr = FI->physical_address;
if (fbaddr == 0)
return -1;
coreboot_video_console.columns = FI->x_resolution / FONT_WIDTH; coreboot_video_console.columns = FI->x_resolution / FONT_WIDTH;
coreboot_video_console.rows = FI->y_resolution / FONT_HEIGHT; coreboot_video_console.rows = FI->y_resolution / FONT_HEIGHT;