From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com ([209.85.128.194]:32783 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751337AbeA2Ogq (ORCPT ); Mon, 29 Jan 2018 09:36:46 -0500 Received: by mail-wr0-f194.google.com with SMTP id s5so7474339wra.0 for ; Mon, 29 Jan 2018 06:36:45 -0800 (PST) Reply-To: christian.koenig@amd.com Subject: Re: [PATCH] drm/ttm: Fix 'buf' pointer update in ttm_bo_vm_access_kmap() (v2) To: Tom St Denis , amd-gfx@lists.freedesktop.org Cc: stable@vger.kernel.org References: <20180129143410.24323-1-tom.stdenis@amd.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <190b12bd-cd5c-7ef3-50f1-5e80dd428ba6@gmail.com> Date: Mon, 29 Jan 2018 15:36:43 +0100 MIME-Version: 1.0 In-Reply-To: <20180129143410.24323-1-tom.stdenis@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: stable-owner@vger.kernel.org List-ID: Greg and other stable maintainers please ignore this one. Tom just misunderstood, what to do with this patch. Thanks, Christian. Am 29.01.2018 um 15:34 schrieb Tom St Denis: > The buf pointer was not being incremented inside the loop > meaning the same block of data would be read or written > repeatedly. > > Fixes: 09ac4fcb3f25 ("drm/ttm: Implement vm_operations_struct.access v2") > > Signed-off-by: Tom St Denis > Reviewed-by: Christian König > > (v2) Change 'buf' pointer to uint8_t* type > --- > drivers/gpu/drm/ttm/ttm_bo_vm.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > 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);