From 097bd95837371aa6410a8673e62144454387270a Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Mon, 24 Jul 2017 19:09:31 +0530 Subject: 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 Reviewed-on: https://review.coreboot.org/20749 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/drivers/intel/fsp2_0/hand_off_block.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3