summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-02-13 01:57:14 +0200
committerAngel Pons <th3fanbus@gmail.com>2021-02-14 20:59:37 +0000
commitb57373b058046815ee987d35eaa1c1729d9fd26a (patch)
tree48b9f1356b477aed53204a1abde0d043c3d37350 /util
parent985f3e05e338d0d8e3aed0028c11471bc626fdc9 (diff)
util/cbfstool: Fix build in 32-bit userspace
Fix regression from commit 0dcc0662f3 util/cbfstool: Introduce concept of mmap_window. Use of region_end() wraps around at 4 GiB, if utility is run in 32bit userspace. The build completes with an invalid coreboot.rom, while one can find error message in stdout or make.log: E: Host address(ffc002e4) not in any mmap window! Change-Id: Ib9b6b60c7b5031122901aabad7b3aa8d59f1bc68 Signed-off-by: Furquan Shaikh <furquan@google.com> Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50618 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'util')
-rw-r--r--util/cbfstool/cbfstool.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 57c9e5117f..2f920e0988 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -255,7 +255,8 @@ static int find_mmap_window(enum mmap_addr_type addr_type, unsigned int addr)
else
reg = &mmap_window_table[i].flash_space;
- if (region_offset(reg) <= addr && region_end(reg) >= addr)
+ if (region_offset(reg) <= addr &&
+ ((uint64_t)region_offset(reg) + (uint64_t)region_sz(reg) - 1) >= addr)
return i;
}