From 98409cff92c741e94ede1a396293c48d05dd9a25 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Mon, 26 Jun 2017 01:38:00 -0700 Subject: libpayload: corebootfb: Add null check for framebuffer address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.coreboot.org/20368 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Philipp Deppenwiese Reviewed-by: Paul Menzel --- payloads/libpayload/drivers/video/corebootfb.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'payloads/libpayload/drivers/video') 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; -- cgit v1.2.3