rk: revert 20f3d0b+v3.0.66 to v3.0
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / i915 / i915_gem_execbuffer.c
index 490ab6b17cfb3744366156a67b9104670a394501..4934cf84c320336aa84320da544cc1e0d091da1c 100644 (file)
@@ -655,8 +655,6 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
        total = 0;
        for (i = 0; i < count; i++) {
                struct drm_i915_gem_relocation_entry __user *user_relocs;
-               u64 invalid_offset = (u64)-1;
-               int j;
 
                user_relocs = (void __user *)(uintptr_t)exec[i].relocs_ptr;
 
@@ -667,25 +665,6 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
                        goto err;
                }
 
-               /* As we do not update the known relocation offsets after
-                * relocating (due to the complexities in lock handling),
-                * we need to mark them as invalid now so that we force the
-                * relocation processing next time. Just in case the target
-                * object is evicted and then rebound into its old
-                * presumed_offset before the next execbuffer - if that
-                * happened we would make the mistake of assuming that the
-                * relocations were valid.
-                */
-               for (j = 0; j < exec[i].relocation_count; j++) {
-                       if (copy_to_user(&user_relocs[j].presumed_offset,
-                                        &invalid_offset,
-                                        sizeof(invalid_offset))) {
-                               ret = -EFAULT;
-                               mutex_lock(&dev->struct_mutex);
-                               goto err;
-                       }
-               }
-
                reloc_offset[i] = total;
                total += exec[i].relocation_count;
        }
@@ -1067,11 +1046,6 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
                        return -EINVAL;
                }
 
-               if (args->num_cliprects > UINT_MAX / sizeof(*cliprects)) {
-                       DRM_DEBUG("execbuf with %u cliprects\n",
-                                 args->num_cliprects);
-                       return -EINVAL;
-               }
                cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects),
                                    GFP_KERNEL);
                if (cliprects == NULL) {
@@ -1322,8 +1296,7 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
        struct drm_i915_gem_exec_object2 *exec2_list = NULL;
        int ret;
 
-       if (args->buffer_count < 1 ||
-           args->buffer_count > UINT_MAX / sizeof(*exec2_list)) {
+       if (args->buffer_count < 1) {
                DRM_ERROR("execbuf2 with %d buffers\n", args->buffer_count);
                return -EINVAL;
        }