[coreboot-gerrit] Change in coreboot[master]: drivers/intel/fsp1_1: Handle errors in find_fsp()

Werner Zeh (Code Review) gerrit at coreboot.org
Thu Jul 13 13:30:44 CEST 2017


Werner Zeh has uploaded this change for review. ( https://review.coreboot.org/20560


Change subject: drivers/intel/fsp1_1: Handle errors in find_fsp()
......................................................................

drivers/intel/fsp1_1: Handle errors in find_fsp()

The function find_fsp() parses the FSP header and returns either a valid
pointer to the FSP_INFO_HEADER or an error code. The caller of
find_fsp() only takes care about a NULL-pointer but not about a possible
error code. This leads to memory access violations in case of error when
FspTempRamInit is called.

To avoid this and to let the user know that there was an error while
parsing the FSP header show an error message and the error code.

Change-Id: I67fef0a53fb04c8ba5d18b5d4ef2fdc1aeba869e
Signed-off-by: Werner Zeh <werner.zeh at siemens.com>
---
M src/drivers/intel/fsp1_1/bootblock.c
1 file changed, 5 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/20560/1

diff --git a/src/drivers/intel/fsp1_1/bootblock.c b/src/drivers/intel/fsp1_1/bootblock.c
index c0f26d9..685609e 100644
--- a/src/drivers/intel/fsp1_1/bootblock.c
+++ b/src/drivers/intel/fsp1_1/bootblock.c
@@ -35,6 +35,11 @@
 	/* Locate the FSP header */
 	fih = find_fsp(CONFIG_FSP_LOC);
 	/* Check the FSP header */
+	if (((uint32_t)fih >= ERROR_NO_FV_SIG) &&
+	    ((uint32_t)fih <= ERROR_FSP_REV_MISMATCH)) {
+		printk(BIOS_ERR, "FSP header error %d, ", (uint32_t)fih);
+		fih = NULL;
+	}
 	if (fih == NULL)
 		die("FSP_INFO_HEADER not set!\n");
 

-- 
To view, visit https://review.coreboot.org/20560
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I67fef0a53fb04c8ba5d18b5d4ef2fdc1aeba869e
Gerrit-Change-Number: 20560
Gerrit-PatchSet: 1
Gerrit-Owner: Werner Zeh <werner.zeh at siemens.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170713/5a28f6e7/attachment.html>


More information about the coreboot-gerrit mailing list