[coreboot-gerrit] New patch to review for coreboot: cbfstool: Fix potential error when using hash attribute

Werner Zeh (werner.zeh@siemens.com) gerrit at coreboot.org
Fri Jan 22 19:48:03 CET 2016


Werner Zeh (werner.zeh at siemens.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13136

-gerrit

commit edaca188d15223a4ab80beb89290d08ebdc25430
Author: Werner Zeh <werner.zeh at siemens.com>
Date:   Fri Jan 22 19:43:01 2016 +0100

    cbfstool: Fix potential error when using hash attribute
    
    There can be an error when a cbfs file is added aligned or as
    xip-stage and hashing of this file is enabled. This commit
    resolves this error. Though adding a file to a fixed position
    while hashing is used can still lead to errors.
    
    Change-Id: Icd98d970891410538909db2830666bf159553133
    Signed-off-by: Werner Zeh <werner.zeh at siemens.com>
---
 util/cbfstool/cbfstool.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 0ac1eec..23787d8 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -162,6 +162,10 @@ static int do_cbfs_locate(int32_t *cbfs_addr, size_t metadata_size)
 			metadata_size += sizeof(struct cbfs_file_attr_position);
 	}
 
+	/* Take care of the hash attribute if it is used */
+	if (param.hash != VB2_HASH_INVALID)
+		metadata_size += sizeof(struct cbfs_file_attr_hash);
+
 	int32_t address = cbfs_locate_entry(&image, buffer.size, param.pagesize,
 						param.alignment, metadata_size);
 	buffer_delete(&buffer);



More information about the coreboot-gerrit mailing list