diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-12-23 14:57:59 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-12-23 16:07:41 +0000 |
commit | 07e19ea4f743bb204ed63a2f2f1235811a2e942a (patch) | |
tree | 6041479a23603aa1c657c81fd639d25606fef576 /drivers/gpu/drm/i915/i915_vma.c | |
parent | 8bfc478fa455b4908f745df368355b415460c60e (diff) | |
download | op-kernel-dev-07e19ea4f743bb204ed63a2f2f1235811a2e942a.zip op-kernel-dev-07e19ea4f743bb204ed63a2f2f1235811a2e942a.tar.gz |
drm/i915: Assert that the partial VMA fits within the object
When creating a partial VMA assert that it first fits with the parent
object, and that if it covers the whole of the parent a normal view was
created instead.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161223145804.6605-5-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/i915_vma.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_vma.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c index fd75d57..868d061 100644 --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c @@ -95,8 +95,13 @@ __i915_vma_create(struct drm_i915_gem_object *obj, if (view) { vma->ggtt_view = *view; if (view->type == I915_GGTT_VIEW_PARTIAL) { + GEM_BUG_ON(range_overflows_t(u64, + view->params.partial.offset, + view->params.partial.size, + obj->base.size >> PAGE_SHIFT)); vma->size = view->params.partial.size; vma->size <<= PAGE_SHIFT; + GEM_BUG_ON(vma->size >= obj->base.size); } else if (view->type == I915_GGTT_VIEW_ROTATED) { vma->size = intel_rotation_info_size(&view->params.rotated); |