From 3d7b1e3b5c04304d3680bd950e7672f6336b01d6 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sat, 22 Dec 2018 00:53:14 +0100 Subject: Fix verification with sparse layouts The full verification step was not accounting for sparse layouts. Instead of the old contents, combine_image_by_layout() implicitly assumed the new contents for unspecified regions. Change-Id: I44e0cea621f2a3d4dc70fa7e93c52ed95e54014a Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/flashrom/+/30370 Tested-by: build bot (Jenkins) Reviewed-by: Philipp Deppenwiese --- layout.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'layout.c') diff --git a/layout.c b/layout.c index e10bb735a..5080e3ed7 100644 --- a/layout.c +++ b/layout.c @@ -227,3 +227,21 @@ int normalize_romentries(const struct flashctx *flash) return ret; } + +const struct romentry *layout_next_included_region( + const struct flashrom_layout *const l, const chipoff_t where) +{ + unsigned int i; + const struct romentry *lowest = NULL; + + for (i = 0; i < l->num_entries; ++i) { + if (!l->entries[i].included) + continue; + if (l->entries[i].end < where) + continue; + if (!lowest || lowest->start > l->entries[i].start) + lowest = &l->entries[i]; + } + + return lowest; +} -- cgit v1.2.3