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@siemens.com>
Reviewed-on: https://review.coreboot.org/20560
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Werner Zeh 2017-07-13 13:21:33 +02:00 committed by Martin Roth
parent 0e660873bf
commit 52793444be
1 changed files with 5 additions and 0 deletions

View File

@ -35,6 +35,11 @@ void bootblock_fsp_temp_ram_init(void)
/* Locate the FSP header */
fih = find_fsp(CONFIG_FSP_LOC);
/* Check the FSP header */
if (((uintptr_t)fih >= ERROR_NO_FV_SIG) &&
((uintptr_t)fih <= ERROR_FSP_REV_MISMATCH)) {
printk(BIOS_ERR, "FSP header error %p, ", fih);
fih = NULL;
}
if (fih == NULL)
die("FSP_INFO_HEADER not set!\n");