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 <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/17480
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Martin Roth 2016-11-18 12:02:18 -07:00
parent ad6c885ce4
commit 53bd26f531
1 changed files with 2 additions and 0 deletions

View File

@ -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();
}