Skip to content

Commit

Permalink
drm: Fix a bug in the range manager.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Hellstrom authored and Dave Airlie committed Feb 15, 2010
1 parent 724e6d3 commit 775c670
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/drm_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 775c670

Please sign in to comment.