diff options
author | Furquan Shaikh <furquan@google.com> | 2020-05-06 13:18:05 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-05-08 15:29:22 +0000 |
commit | f8f5650873451f64eab84d4b20248419bc19a0f5 (patch) | |
tree | 044f5e0504609687880f68ce406d1bf5f3c9517e | |
parent | 8211bde9c2a2cf80b82573df6122ca4dd3c764cf (diff) | |
download | coreboot-f8f5650873451f64eab84d4b20248419bc19a0f5.tar.gz coreboot-f8f5650873451f64eab84d4b20248419bc19a0f5.tar.bz2 coreboot-f8f5650873451f64eab84d4b20248419bc19a0f5.zip |
memrange: Break early from memranges_find_entry if limit is crossed
This change updates memranges_find_entry() to break and return early
if the end address of the hole within the current range entry crosses
the requested limit. This is because all range entries and maintained
in increasing order and so none of the following range entries can
satisfy the given request.
Change-Id: I14e03946ddbbb5d254b23e9a9917da42960313a6
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41104
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r-- | src/lib/memrange.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/memrange.c b/src/lib/memrange.c index 32f053de0849..bc827d363577 100644 --- a/src/lib/memrange.c +++ b/src/lib/memrange.c @@ -400,8 +400,13 @@ static const struct range_entry *memranges_find_entry(struct memranges *ranges, if (end > r->end) continue; + /* + * If end for the hole in the current range entry goes beyond the requested + * limit, then none of the following ranges can satisfy this request because all + * range entries are maintained in increasing order. + */ if (end > limit) - continue; + break; return r; } |