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>
This commit is contained in:
parent
8211bde9c2
commit
f8f5650873
|
@ -400,8 +400,13 @@ static const struct range_entry *memranges_find_entry(struct memranges *ranges,
|
||||||
if (end > r->end)
|
if (end > r->end)
|
||||||
continue;
|
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)
|
if (end > limit)
|
||||||
continue;
|
break;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue