util/cbfstool: Check for NULL before dereference

Fixed coverity issue: 1302455 - Dereference null return value

Change-Id: I59b908adc4d35f08fda8e4ad3f806714f2caeb65
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/22900
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Martin Roth 2017-12-15 10:18:57 -07:00
parent ec2e61ab2f
commit f183a85932
1 changed files with 4 additions and 0 deletions

View File

@ -196,6 +196,10 @@ partitioned_file_t *partitioned_file_reopen(const char *filename,
const struct fmap_area *fmap_fmap_entry =
fmap_find_area(file->fmap, SECTION_NAME_FMAP);
if (!fmap_fmap_entry)
return NULL;
if ((long)fmap_fmap_entry->offset != fmap_region_offset) {
ERROR("FMAP's '%s' section doesn't point back to FMAP start (did something corrupt this file?)\n",
SECTION_NAME_FMAP);