]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/gpu/drm/i915/i915_vma.c
drm/i915: move vma sanity checking into i915_vma_bind
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / i915 / i915_vma.c
index 37c3eebe8316a7c249e14396f90709a099222ebc..9e121222c5ebfeb007c45a70f68617dd1e78e531 100644 (file)
@@ -176,6 +176,12 @@ 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))
+               return -ENODEV;
+
        if (vma_flags == 0 && vma->vm->allocate_va_range) {
                trace_i915_va_alloc(vma);
                ret = vma->vm->allocate_va_range(vma->vm,