Commit 775c6709 authored by Thomas Hellstrom's avatar Thomas Hellstrom Committed by Dave Airlie

drm: Fix a bug in the range manager.

When searching for free space in a range, the function could return a node extending outside of the given range.
Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 724e6d3f
...@@ -405,7 +405,8 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm, ...@@ -405,7 +405,8 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm,
wasted += alignment - tmp; wasted += alignment - tmp;
} }
if (entry->size >= size + wasted) { if (entry->size >= size + wasted &&
(entry->start + wasted + size) <= end) {
if (!best_match) if (!best_match)
return entry; return entry;
if (entry->size < best_size) { if (entry->size < best_size) {
......
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