Commit f8f56508 authored by Furquan Shaikh's avatar Furquan Shaikh Committed by Patrick Georgi
Browse files

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: default avatarFurquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41104

Tested-by: default avatarbuild bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: default avatarAaron Durbin <adurbin@chromium.org>
parent 8211bde9
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment