summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2017-06-26 01:38:00 -0700
committerDuncan Laurie <dlaurie@chromium.org>2017-06-27 02:16:10 +0000
commit98409cff92c741e94ede1a396293c48d05dd9a25 (patch)
tree79325a348cb5df4fc7ce3461121e97a227869f82
parent13bc5e5c801668001044674e8efee93271863a2e (diff)
downloadcoreboot-98409cff92c741e94ede1a396293c48d05dd9a25.tar.xz
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>
-rw-r--r--payloads/libpayload/drivers/video/corebootfb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/video/corebootfb.c b/payloads/libpayload/drivers/video/corebootfb.c
index 46f891f9f5..1aeac12e8c 100644
--- a/payloads/libpayload/drivers/video/corebootfb.c
+++ b/payloads/libpayload/drivers/video/corebootfb.c
@@ -237,6 +237,8 @@ static int corebootfb_init(void)
fbinfo = virt_to_phys(lib_sysinfo.framebuffer);
fbaddr = FI->physical_address;
+ if (fbaddr == 0)
+ return -1;
coreboot_video_console.columns = FI->x_resolution / FONT_WIDTH;
coreboot_video_console.rows = FI->y_resolution / FONT_HEIGHT;