Felix Singer submitted this change.

View Change


Approvals: build bot (Jenkins): Verified Felix Singer: Looks good to me, approved Angel Pons: Looks good to me, approved
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 <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/62611
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67875
Reviewed-by: Felix Singer <felixsinger@posteo.net>
---
M dmi.c
1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/dmi.c b/dmi.c
index c44221c..7488d61 100644
--- a/dmi.c
+++ b/dmi.c
@@ -164,7 +164,7 @@
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;
}

To view, visit change 67875. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: 1.2.x
Gerrit-Change-Id: Ic403c2940c2b91acbd113f0acfa3ce9ef6c6bb6c
Gerrit-Change-Number: 67875
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Felix Singer <felixsinger@posteo.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged