UPSTREAM: 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

BUG=None
BRANCH=None
TEST=None

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>

Change-Id: I92995366ffb15afd0950b9a8bbb6fe16252b2c38
Reviewed-on: https://chromium-review.googlesource.com/415045
Commit-Ready: Aaron Durbin <adurbin@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Martin Roth 2016-11-18 12:02:18 -07:00 committed by chrome-bot
parent 30d88884c5
commit 9c6abbaad6

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