summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_vma.c
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2016-12-13 20:32:22 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-12-16 21:22:12 +0000
commit966d5bf5eb90f2a8c158f6d971ad0a4f836aad9c (patch)
treef3530e77a39efa762b9ca2fea0849b74de985c2b /drivers/gpu/drm/i915/i915_vma.c
parent86e61735710902535ebd00decc035f5e129a377e (diff)
downloadop-kernel-dev-966d5bf5eb90f2a8c158f6d971ad0a4f836aad9c.zip
op-kernel-dev-966d5bf5eb90f2a8c158f6d971ad0a4f836aad9c.tar.gz
drm/i915: convert to using range_overflows
Convert some of the obvious hand-rolled ranged overflow sanity checks to our shiny new range_overflows macro. Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Matthew Auld <matthew.auld@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20161213203222.32564-4-matthew.auld@intel.com Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_vma.c')
-rw-r--r--drivers/gpu/drm/i915/i915_vma.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 9e12122..fd75d57 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -176,10 +176,9 @@ int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
if (bind_flags == 0)
return 0;
- if (GEM_WARN_ON(vma->node.start + vma->node.size < vma->node.start))
- return -ENODEV;
-
- if (GEM_WARN_ON(vma->node.start + vma->node.size > vma->vm->total))
+ if (GEM_WARN_ON(range_overflows(vma->node.start,
+ vma->node.size,
+ vma->vm->total)))
return -ENODEV;
if (vma_flags == 0 && vma->vm->allocate_va_range) {
OpenPOWER on IntegriCloud