summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem_stolen.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-01-30 13:47:21 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-01-31 11:19:23 +0000
commit1692cd60d999b00a0491692dab0286e6011abd36 (patch)
tree6ca4aad3e28794cb99b9bdc28dfa993054b6c5f1 /drivers/gpu/drm/i915/i915_gem_stolen.c
parentc88473878d47131ccfc67a00ba688d4d7d0f4519 (diff)
downloadtalos-op-linux-1692cd60d999b00a0491692dab0286e6011abd36.tar.gz
talos-op-linux-1692cd60d999b00a0491692dab0286e6011abd36.zip
drm/i915: Sanity check the computed size and base of stolen memory
Just do a quick check that the stolen memory address range doesn't overflow our chosen integer type. v2: Add add_overflows() to utils with the promise that gcc7 can do this better than C and then maybe it will have a proper definition in core. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170130134721.5159-1-chris@chris-wilson.co.uk Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_stolen.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_stolen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index a75de8c6ece0..cba12ee90cbf 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 || add_overflows(base, ggtt->stolen_size))
return 0;
/* make sure we don't clobber the GTT if it's within stolen memory */
OpenPOWER on IntegriCloud