diff mbox

[2/2] drm/i915: WARN if the bios reserved range is bigger than stolen size

Message ID 1373373867-28080-2-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter July 9, 2013, 12:44 p.m. UTC
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>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Chris Wilson July 9, 2013, 1:56 p.m. UTC | #1
On Tue, Jul 09, 2013 at 02:44:27PM +0200, Daniel Vetter wrote:
> 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>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Daniel Vetter July 9, 2013, 2:53 p.m. UTC | #2
On Tue, Jul 09, 2013 at 02:56:33PM +0100, Chris Wilson wrote:
> On Tue, Jul 09, 2013 at 02:44:27PM +0200, Daniel Vetter wrote:
> > 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>
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Queued for -next, thanks for the review.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 24cae1c..5c1a535 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -218,6 +218,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);