diff mbox

[01/12] drm/ttm: Fix 'buf' pointer update in ttm_bo_vm_access_kmap() (v2)

Message ID 20180129135513.22538-2-tom.stdenis@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

StDenis, Tom Jan. 29, 2018, 1:55 p.m. UTC
The buf pointer was not being incremented inside the loop
meaning the same block of data would be read or written
repeatedly.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>

(v2) Change 'buf' pointer to uint8_t* type
---
 drivers/gpu/drm/ttm/ttm_bo_vm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michel Dänzer Jan. 29, 2018, 2:31 p.m. UTC | #1
On 2018-01-29 02:55 PM, Tom St Denis wrote:
> The buf pointer was not being incremented inside the loop
> meaning the same block of data would be read or written
> repeatedly.
> 
> Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>

Please add:

Cc: stable@vger.kernel.org
Fixes: 09ac4fcb3f25 ("drm/ttm: Implement vm_operations_struct.access v2")

so that it'll get backported to the relevant stable branches.
Christian König Jan. 29, 2018, 2:39 p.m. UTC | #2
Am 29.01.2018 um 15:31 schrieb Michel Dänzer:
> On 2018-01-29 02:55 PM, Tom St Denis wrote:
>> The buf pointer was not being incremented inside the loop
>> meaning the same block of data would be read or written
>> repeatedly.
>>
>> Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
>> Reviewed-by: Christian König <christian.koenig@amd.com>
> Please add:
>
> Cc: stable@vger.kernel.org
> Fixes: 09ac4fcb3f25 ("drm/ttm: Implement vm_operations_struct.access v2")

What Michel meant here is that you should add the "Cc: " and "Fixes: " 
tags to the commit message and NOT send it manually to 
stable@vger.kernel.org.

The "Cc:" tag results in automatically backporting of the patch to 
stable kernels. Manually sending a patch to stable@vger.kernel.org is 
only necessary when the automated backport doesn't work.

Christian.

>
> so that it'll get backported to the relevant stable branches.
>
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
index 08a3c324242e..60fcef1593dd 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
@@ -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);