[coreboot-gerrit] Change in coreboot[master]: util/cbfstool: Check for NULL before dereference

Martin Roth (Code Review) gerrit at coreboot.org
Fri Dec 15 18:50:11 CET 2017


Martin Roth has uploaded this change for review. ( https://review.coreboot.org/22900


Change subject: util/cbfstool: Check for NULL before dereference
......................................................................

util/cbfstool: Check for NULL before dereference

Fixed coverity issue: 1302455 - Dereference null return value

Change-Id: I59b908adc4d35f08fda8e4ad3f806714f2caeb65
Signed-off-by: Martin Roth <martinroth at google.com>
---
M util/cbfstool/partitioned_file.c
1 file changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/00/22900/1

diff --git a/util/cbfstool/partitioned_file.c b/util/cbfstool/partitioned_file.c
index 7b4b003..9abd32a 100644
--- a/util/cbfstool/partitioned_file.c
+++ b/util/cbfstool/partitioned_file.c
@@ -196,6 +196,10 @@
 
 	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);

-- 
To view, visit https://review.coreboot.org/22900
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I59b908adc4d35f08fda8e4ad3f806714f2caeb65
Gerrit-Change-Number: 22900
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171215/5db24022/attachment.html>


More information about the coreboot-gerrit mailing list