From: Tom St Denis Date: Fri, 26 Jan 2018 14:32:29 +0000 (-0500) Subject: drm/ttm: Fix 'buf' pointer update in ttm_bo_vm_access_kmap() (v2) X-Git-Tag: Ubuntu-4.15.0-11.12~88 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=8a2d9e82a419726eb3ff709d8654a4da93e2eea4;p=mirror_ubuntu-bionic-kernel.git drm/ttm: Fix 'buf' pointer update in ttm_bo_vm_access_kmap() (v2) BugLink: http://bugs.launchpad.net/bugs/1751131 commit 95244db2d3f743f37e69446a2807dd1a42750542 upstream. 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 Reviewed-by: Christian König Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Signed-off-by: Seth Forshee --- diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index c8ebb757e36b..b17d0d38f290 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -299,7 +299,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; @@ -328,6 +328,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);