Furquan Shaikh has uploaded this change for review.

View Change

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>
---
M src/lib/memrange.c
1 file changed, 6 insertions(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/04/41104/1
diff --git a/src/lib/memrange.c b/src/lib/memrange.c
index 32f053d..bc827d3 100644
--- a/src/lib/memrange.c
+++ b/src/lib/memrange.c
@@ -400,8 +400,13 @@
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;
}

To view, visit change 41104. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I14e03946ddbbb5d254b23e9a9917da42960313a6
Gerrit-Change-Number: 41104
Gerrit-PatchSet: 1
Gerrit-Owner: Furquan Shaikh <furquan@google.com>
Gerrit-MessageType: newchange