diff options
author | Subrata Banik <subrata.banik@intel.com> | 2017-07-24 19:09:31 +0530 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2017-07-25 14:59:48 +0000 |
commit | 097bd95837371aa6410a8673e62144454387270a (patch) | |
tree | 1d805a1e0e6445312292c6ca74342222a71b4741 /src | |
parent | 815417145e4613716a0e01207e97d0ae245d9d04 (diff) |
drivers/intel/fsp2_0: Add NULL check while locating hob list ptr
Assert incase unable to locate hob list pointer due to cbmem
is not available.
Change-Id: I17f54b07ab149ae06d09226ed9063189d829efe2
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/20749
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/intel/fsp2_0/hand_off_block.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c index 4a8e73a83c..2d7e209ec3 100644 --- a/src/drivers/intel/fsp2_0/hand_off_block.c +++ b/src/drivers/intel/fsp2_0/hand_off_block.c @@ -105,10 +105,14 @@ static void *fsp_hob_list_ptr CAR_GLOBAL; static void save_hob_list(int is_recovery) { uint32_t *cbmem_loc; + const void *hob_list; cbmem_loc = cbmem_add(CBMEM_ID_FSP_RUNTIME, sizeof(*cbmem_loc)); if (cbmem_loc == NULL) die("Error: Could not add cbmem area for hob list.\n"); - *cbmem_loc = (uintptr_t)fsp_get_hob_list(); + hob_list = fsp_get_hob_list(); + if (!hob_list) + die("Error: Could not locate hob list pointer.\n"); + *cbmem_loc = (uintptr_t)hob_list; } ROMSTAGE_CBMEM_INIT_HOOK(save_hob_list); @@ -167,6 +171,9 @@ int fsp_find_range_hob(struct range_entry *re, const uint8_t guid[16]) const struct hob_resource *fsp_mem; const void *hob_list = fsp_get_hob_list(); + if (!hob_list) + return -1; + range_entry_init(re, 0, 0, 0); fsp_mem = find_resource_hob_by_guid(hob_list, guid); |