summaryrefslogtreecommitdiff
path: root/tests/lib/region_file-test.c
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2024-01-14 14:26:37 +0100
committerJulius Werner <jwerner@chromium.org>2024-08-23 01:08:16 +0000
commit41feb32559d574e7e08f42742dc4ef8abc3ddd46 (patch)
tree3ebbce83ef7805f80c94240d9cde356cf944694a /tests/lib/region_file-test.c
parent7bb8de184338453cde924c816e027af5eae40d32 (diff)
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>
Diffstat (limited to 'tests/lib/region_file-test.c')
-rw-r--r--tests/lib/region_file-test.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/tests/lib/region_file-test.c b/tests/lib/region_file-test.c
index 56bb8e4f01..7607aafe96 100644
--- a/tests/lib/region_file-test.c
+++ b/tests/lib/region_file-test.c
@@ -145,12 +145,8 @@ static void test_region_file_init_real_data(void **state)
static void test_region_file_init_invalid_region_device(void **state)
{
struct region_device bad_dev;
- struct region_file regf;
-
- rdev_chain_mem_rw(&bad_dev, NULL, 0);
- /* Expect fail when passing invalid region_device. */
- assert_int_equal(-1, region_file_init(&regf, &bad_dev));
+ assert_int_equal(rdev_chain_mem_rw(&bad_dev, NULL, 0), -1);
}
static void test_region_file_data(void **state)