aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_vma.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-01-06 15:20:12 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-01-06 16:02:11 +0000
commite8f9ae9b5062b43b6cb3dd6e45107c8edf25f1d0 (patch)
tree0d3f27edb80442d34c5f0124394a47302530511b /drivers/gpu/drm/i915/i915_vma.c
parentdrm/i915: Use fixed-sized types for stolen (diff)
downloadlinux-dev-e8f9ae9b5062b43b6cb3dd6e45107c8edf25f1d0.tar.xz
linux-dev-e8f9ae9b5062b43b6cb3dd6e45107c8edf25f1d0.zip
drm/i915: Use range_overflows()
Replace a few more open-coded overflow checks with the macro. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170106152013.24684-4-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/i915_vma.c')
-rw-r--r--drivers/gpu/drm/i915/i915_vma.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index d48c68214611..58f2483362ad 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -403,7 +403,8 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
if (flags & PIN_OFFSET_FIXED) {
u64 offset = flags & PIN_OFFSET_MASK;
- if (offset & (alignment - 1) || offset > end - size) {
+ if (offset & (alignment - 1) ||
+ range_overflows(offset, size, end)) {
ret = -EINVAL;
goto err_unpin;
}