[Intel-gfx] [PATCH] drm/i915: Sanity check the computed size and base of stolen memory
Chris Wilson
chris at chris-wilson.co.uk
Fri Jan 27 17:20:08 UTC 2017
Just do a quick check that the stolen memory address range doesn't
overflow our chosen integer type.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 42bbc4b04fd6..37a26e1c9190 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -189,7 +189,7 @@ static dma_addr_t i915_stolen_to_dma(struct drm_i915_private *dev_priv)
base = tom - tseg_size - ggtt->stolen_size;
}
- if (base == 0)
+ if (base == 0 || base + ggtt->stolen_size <= base)
return 0;
/* make sure we don't clobber the GTT if it's within stolen memory */
--
2.11.0
More information about the Intel-gfx
mailing list