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: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Thomas Hellstrom 2010-02-12 00:17:59 +01:00 committed by Dave Airlie
parent 724e6d3fe8
commit 775c67090c
1 changed files with 2 additions and 1 deletions

View File

@ -405,7 +405,8 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm,
wasted += alignment - tmp;
}
if (entry->size >= size + wasted) {
if (entry->size >= size + wasted &&
(entry->start + wasted + size) <= end) {
if (!best_match)
return entry;
if (entry->size < best_size) {