summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/memrange.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/memrange.c b/src/lib/memrange.c
index 32f053de08..bc827d3635 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;
}