src/drivers/intel: Avoid NULL pointer dereference

Coverity detects pointer fih as FORWARD_NULL. Add sanity check
for fih to prevent NULL pointer dereference.

BUG=CID 1401717
TEST=Built and boot up to kernel.

Change-Id: Ia6853e5302c87d9ffe52b942f067be56f6e77406
Signed-off-by: John Zhao <john.zhao@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/33150
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
This commit is contained in:
John Zhao 2019-05-31 09:58:49 -07:00 committed by Philipp Deppenwiese
parent c53665ce55
commit d3a73280cc
1 changed files with 3 additions and 0 deletions

View File

@ -120,6 +120,9 @@ void mainboard_romstage_entry(unsigned long bist)
* the flash is memory mapped CPU's address space. */
FSP_INFO_HEADER *fih = find_fsp((uintptr_t)rdev_mmap_full(prog_rdev(&fsp)));
if (!fih)
die("Invalid FSP header\n");
cache_as_ram_stage_main(fih);
}