Skip to contentSkip to conversation

drm: Fix a bug in the range manager.

PATCH RESEND New Thomas Hellstrom 1 participant 1 message Feb 12, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/2 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.

---
 drivers/gpu/drm/drm_mm.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/drm_mm.c +2 -1
index cdec329..2ac074c 100644
@@ -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) {
Signature · 8 lines
1.6.2.5


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--