region: Turn region_end() into an inclusive region_last()
The current region_end() implementation is susceptible to overflow if the region is at the end of the addressable space. A common case with the memory-mapped flash of x86 directly below the 32-bit limit. Note: This patch also changes console output to inclusive limits. IMO, to the better. Change-Id: Ic4bd6eced638745b7e845504da74542e4220554a Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/79946 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
committed by
Julius Werner
parent
7bb8de1843
commit
41feb32559
@@ -423,9 +423,9 @@ static bool create_mmap_windows(void)
|
||||
&mmap_window_table[j].flash_space)) {
|
||||
ERROR("Flash space windows (base=0x%zx, limit=0x%zx) and (base=0x%zx, limit=0x%zx) overlap!\n",
|
||||
region_offset(&mmap_window_table[i].flash_space),
|
||||
region_end(&mmap_window_table[i].flash_space),
|
||||
region_last(&mmap_window_table[i].flash_space),
|
||||
region_offset(&mmap_window_table[j].flash_space),
|
||||
region_end(&mmap_window_table[j].flash_space));
|
||||
region_last(&mmap_window_table[j].flash_space));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -433,9 +433,9 @@ static bool create_mmap_windows(void)
|
||||
&mmap_window_table[j].host_space)) {
|
||||
ERROR("Host space windows (base=0x%zx, limit=0x%zx) and (base=0x%zx, limit=0x%zx) overlap!\n",
|
||||
region_offset(&mmap_window_table[i].flash_space),
|
||||
region_end(&mmap_window_table[i].flash_space),
|
||||
region_last(&mmap_window_table[i].flash_space),
|
||||
region_offset(&mmap_window_table[j].flash_space),
|
||||
region_end(&mmap_window_table[j].flash_space));
|
||||
region_last(&mmap_window_table[j].flash_space));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user