[coreboot-gerrit] New patch to review for coreboot: drivers/intel/fsp2_0: Check for NULL before using pointer

Martin Roth (martinroth@google.com) gerrit at coreboot.org
Fri Nov 18 20:25:44 CET 2016


Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17480

-gerrit

commit 5698d91315d9ca5ba4c76305cdce03d0b49bc822
Author: Martin Roth <martinroth at google.com>
Date:   Fri Nov 18 12:02:18 2016 -0700

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

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



More information about the coreboot-gerrit mailing list