Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/79945?usp=email )
Change subject: [NEEDS TEST] region: Check for overflows after offset calculation ......................................................................
[NEEDS TEST] region: Check for overflows after offset calculation
As we currently do not know where overflows actually happen, this needs testing to avoid boot failures due to potential bugs somewhere else.
Change-Id: Ia6054e6e9b6f13502351a2d94c8a0af15266e43e Signed-off-by: Nico Huber nico.h@gmx.de --- M src/commonlib/region.c 1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/79945/1
diff --git a/src/commonlib/region.c b/src/commonlib/region.c index 4153f0a..9dc6637 100644 --- a/src/commonlib/region.c +++ b/src/commonlib/region.c @@ -22,7 +22,8 @@ static int normalize_and_ok(const struct region *outer, struct region *inner) { inner->offset += region_offset(outer); - return region_is_subregion(outer, inner); + return region_end(inner) - 1 >= region_offset(inner) && + region_is_subregion(outer, inner); }
static const struct region_device *rdev_root(const struct region_device *rdev)