From fd4cb2d7b472393cb534218510f22969f931c4cb Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sun, 6 Mar 2022 00:21:52 +0100 Subject: dmi: Correctly check for ERROR_PTR For the physmap*() functions, NULL is considered valid return value. Fixes a segmentation fault when DMI tables can't be mapped. Tested on intel/eblake board with broken coreboot. Change-Id: Ic403c2940c2b91acbd113f0acfa3ce9ef6c6bb6c Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/flashrom/+/62611 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- dmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dmi.c') diff --git a/dmi.c b/dmi.c index 16d350df..a7b300da 100644 --- a/dmi.c +++ b/dmi.c @@ -164,7 +164,7 @@ static void dmi_table(uint32_t base, uint16_t len, uint16_t num) unsigned int i = 0, j = 0; uint8_t *dmi_table_mem = physmap_ro("DMI Table", base, len); - if (dmi_table_mem == NULL) { + if (dmi_table_mem == ERROR_PTR) { msg_perr("Unable to access DMI Table\n"); return; } -- cgit v1.2.3