[coreboot-gerrit] Change in coreboot[master]: drivers/intel/fsp2_0: Add NULL check while locating hob list ptr

Subrata Banik (Code Review) gerrit at coreboot.org
Mon Jul 24 15:43:56 CEST 2017


Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/20749


Change subject: drivers/intel/fsp2_0: Add NULL check while locating hob list ptr
......................................................................

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 at intel.com>
---
M src/drivers/intel/fsp2_0/hand_off_block.c
1 file changed, 8 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/20749/1

diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c
index 4a8e73a..2d7e209 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 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 @@
 	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);

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

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I17f54b07ab149ae06d09226ed9063189d829efe2
Gerrit-Change-Number: 20749
Gerrit-PatchSet: 1
Gerrit-Owner: Subrata Banik <subrata.banik at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170724/81b7a41a/attachment-0001.html>


More information about the coreboot-gerrit mailing list