diff options
author | Werner Zeh <werner.zeh@siemens.com> | 2016-01-22 19:43:01 +0100 |
---|---|---|
committer | Werner Zeh <werner.zeh@siemens.com> | 2016-01-23 11:49:10 +0100 |
commit | c7b2b7c67dc8afb52c3dc8e9297e5ed81fa22674 (patch) | |
tree | 87bf676d9a8633e01a1a2d67754f282694b54076 /util | |
parent | 4408409d05f5ba85f4249f477ce3f243bee862c2 (diff) |
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@siemens.com>
Reviewed-on: https://review.coreboot.org/13136
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/cbfstool/cbfstool.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 0ac1eecc5e..23787d89f4 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); |