[coreboot-gerrit] Patch set updated for coreboot: cbfstool: prepare moving tests earlier

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Thu Aug 13 10:27:55 CEST 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11220

-gerrit

commit e7b011b9611dd5199aaf4203ad7f14e489a3628c
Author: Patrick Georgi <pgeorgi at google.com>
Date:   Wed Aug 12 12:01:01 2015 +0200

    cbfstool: prepare moving tests earlier
    
    The assert() makes sure the if() holds true. But that assert won't survive for
    long.
    
    Change-Id: Iab7d2bc7bfebb3f3b3ce70dc5bd041902e14bd7a
    Signed-off-by: Patrick Georgi <pgeorgi at google.com>
---
 util/cbfstool/cbfs_image.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index ddc9cf5..1a20fba 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -616,18 +616,20 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
 		// We need to put content here, and the case is really
 		// complicated...
 		assert(content_offset);
-		if (addr_next < content_offset) {
-			DEBUG("Not for specified offset yet");
-			continue;
-		} else if (addr > content_offset) {
-			DEBUG("Exceed specified content_offset.");
-			break;
-		} else if (addr + header_size > content_offset) {
-			ERROR("Not enough space for header.\n");
-			break;
-		} else if (content_offset + buffer->size > addr_next) {
-			ERROR("Not enough space for content.\n");
-			break;
+		if (content_offset > 0) {
+			if (addr_next < content_offset) {
+				DEBUG("Not for specified offset yet");
+				continue;
+			} else if (addr > content_offset) {
+				DEBUG("Exceed specified content_offset.");
+				break;
+			} else if (addr + header_size > content_offset) {
+				ERROR("Not enough space for header.\n");
+				break;
+			} else if (content_offset + buffer->size > addr_next) {
+				ERROR("Not enough space for content.\n");
+				break;
+			}
 		}
 
 		// TODO there are more few tricky cases that we may



More information about the coreboot-gerrit mailing list