[1/2,RESEND] drm: Fix a bug in the range manager.
diff mbox

Message ID 1265966547-12690-1-git-send-email-thellstrom@vmware.com
State Accepted
Headers show

Commit Message

Thomas Hellstrom Feb. 12, 2010, 9:22 a.m. UTC
None

Patch
diff mbox

diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index cdec329..2ac074c 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -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) {