drm/i915: WARN if the bios reserved range is bigger than stolen size
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 9 Jul 2013 12:44:27 +0000 (14:44 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 9 Jul 2013 14:53:24 +0000 (16:53 +0200)
v2: Bail out if we hit the WARN_ON to avoid fallout later on. Spotted
by Chris Wilson.

Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_stolen.c

index a3ce2cb..76c3b86 100644 (file)
@@ -215,6 +215,9 @@ int i915_gem_init_stolen(struct drm_device *dev)
        if (IS_VALLEYVIEW(dev))
                bios_reserved = 1024*1024; /* top 1M on VLV/BYT */
 
+       if (WARN_ON(bios_reserved > dev_priv->gtt.stolen_size))
+               return 0;
+
        /* Basic memrange allocator for stolen space */
        drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->gtt.stolen_size -
                    bios_reserved);