flashrom.c: Allow unaligned erase blocks in select_erase_function()
Simply check if an erase block overlaps the given region.
Change-Id: I06f64dad2cbf7e710d4129aec55496518d7c452e
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72560
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/flashrom.c b/flashrom.c
index c18ff43..3047017 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1081,7 +1081,7 @@
{
struct eraseblock_data *ll = &layout[findex].layout_list[block_num];
if (!findex) {
- if (ll->start_addr >= info->region_start && ll->end_addr <= info->region_end) {
+ if (ll->start_addr <= info->region_end && ll->end_addr >= info->region_start) {
const chipoff_t write_start = MAX(info->region_start, ll->start_addr);
const chipoff_t write_end = MIN(info->region_end, ll->end_addr);
const chipsize_t write_len = write_end - write_start + 1;