From 53bd26f531d9ee920948a931a03aae23de21f0ce Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Fri, 18 Nov 2016 12:02:18 -0700 Subject: drivers/intel/fsp2_0: Check for NULL before using pointer The cbmem routines pass back NULL on error. Check for this before using the pointer. Addresses coverity issue 1365731 - Dereference null return value Change-Id: I92995366ffb15afd0950b9a8bbb6fe16252b2c38 Signed-off-by: Martin Roth Reviewed-on: https://review.coreboot.org/17480 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- src/drivers/intel/fsp2_0/hand_off_block.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/drivers') diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c index a8b9878d9f..4a8e73a83c 100644 --- a/src/drivers/intel/fsp2_0/hand_off_block.c +++ b/src/drivers/intel/fsp2_0/hand_off_block.c @@ -106,6 +106,8 @@ static void save_hob_list(int is_recovery) { uint32_t *cbmem_loc; 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(); } -- cgit v1.2.3