drm/vmwgfx: Fix legacy surface reference size copyback
authorThomas Hellstrom <thellstrom@vmware.com>
Thu, 30 Jan 2014 10:18:38 +0000 (11:18 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Wed, 5 Feb 2014 07:38:03 +0000 (08:38 +0100)
Surfaces created using the guest-backed surface interface only keeps the
base mip size, so only copy that if the legacy surface reference
ioctl requests the size information.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c

index 979da1c246a543a445257daee03787e794b266a1..ec2b99833fcef55792a4d7d920f14dd072dd87e3 100644 (file)
@@ -908,8 +908,8 @@ int vmw_surface_reference_ioctl(struct drm_device *dev, void *data,
            rep->size_addr;
 
        if (user_sizes)
-               ret = copy_to_user(user_sizes, srf->sizes,
-                                  srf->num_sizes * sizeof(*srf->sizes));
+               ret = copy_to_user(user_sizes, &srf->base_size,
+                                  sizeof(srf->base_size));
        if (unlikely(ret != 0)) {
                DRM_ERROR("copy_to_user failed %p %u\n",
                          user_sizes, srf->num_sizes);