drm/ttm: Fix 'buf' pointer update in ttm_bo_vm_access_kmap() (v2)
authorTom St Denis <tom.stdenis@amd.com>
Fri, 26 Jan 2018 14:32:29 +0000 (09:32 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 30 Jan 2018 04:09:31 +0000 (23:09 -0500)
The buf pointer was not being incremented inside the loop
meaning the same block of data would be read or written
repeatedly.

(v2) Change 'buf' pointer to uint8_t* type

Cc: stable@vger.kernel.org
Fixes: 09ac4fcb3f25 ("drm/ttm: Implement vm_operations_struct.access v2")
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/ttm/ttm_bo_vm.c

index 08a3c324242e6fe705dc989e9888ac3b4fa23137..60fcef1593dd643af7c11f7dd546cba8d11d2115 100644 (file)
@@ -316,7 +316,7 @@ static void ttm_bo_vm_close(struct vm_area_struct *vma)
 
 static int ttm_bo_vm_access_kmap(struct ttm_buffer_object *bo,
                                 unsigned long offset,
-                                void *buf, int len, int write)
+                                uint8_t *buf, int len, int write)
 {
        unsigned long page = offset >> PAGE_SHIFT;
        unsigned long bytes_left = len;
@@ -345,6 +345,7 @@ static int ttm_bo_vm_access_kmap(struct ttm_buffer_object *bo,
                ttm_bo_kunmap(&map);
 
                page++;
+               buf += bytes;
                bytes_left -= bytes;
                offset = 0;
        } while (bytes_left);