> -----Original Message----- > From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf > Of Christian König > Sent: Thursday, July 27, 2017 11:44 AM > To: amd-gfx at lists.freedesktop.org > Subject: [PATCH 2/8] drm/amdgpu: consistent use u64_to_user_ptr > > From: Christian König <christian.koenig at amd.com> > > Instead of open coding the conversion from u64 to pointers. > > Signed-off-by: Christian König <christian.koenig at amd.com> Reviewed-by: Alex Deucher <alexander.deucher at amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 8 ++++---- > drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c > index 6fd5831..fd5d192 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c > @@ -270,7 +270,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, > void *data, > struct amdgpu_fpriv *fpriv = filp->driver_priv; > union drm_amdgpu_bo_list *args = data; > uint32_t handle = args->in.list_handle; > - const void __user *uptr = (const void*)(uintptr_t)args- > >in.bo_info_ptr; > + const void __user *uptr = u64_to_user_ptr(args->in.bo_info_ptr); > > struct drm_amdgpu_bo_list_entry *info; > struct amdgpu_bo_list *list; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > index 44ec11d..cd5c08a 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > @@ -89,7 +89,7 @@ static int amdgpu_cs_parser_init(struct > amdgpu_cs_parser *p, void *data) > } > > /* get chunks */ > - chunk_array_user = (uint64_t __user *)(uintptr_t)(cs->in.chunks); > + chunk_array_user = u64_to_user_ptr(cs->in.chunks); > if (copy_from_user(chunk_array, chunk_array_user, > sizeof(uint64_t)*cs->in.num_chunks)) { > ret = -EFAULT; > @@ -109,7 +109,7 @@ static int amdgpu_cs_parser_init(struct > amdgpu_cs_parser *p, void *data) > struct drm_amdgpu_cs_chunk user_chunk; > uint32_t __user *cdata; > > - chunk_ptr = (void __user *)(uintptr_t)chunk_array[i]; > + chunk_ptr = u64_to_user_ptr(chunk_array[i]); > if (copy_from_user(&user_chunk, chunk_ptr, > sizeof(struct drm_amdgpu_cs_chunk))) { > ret = -EFAULT; > @@ -120,7 +120,7 @@ static int amdgpu_cs_parser_init(struct > amdgpu_cs_parser *p, void *data) > p->chunks[i].length_dw = user_chunk.length_dw; > > size = p->chunks[i].length_dw; > - cdata = (void __user *)(uintptr_t)user_chunk.chunk_data; > + cdata = u64_to_user_ptr(user_chunk.chunk_data); > > p->chunks[i].kdata = drm_malloc_ab(size, sizeof(uint32_t)); > if (p->chunks[i].kdata == NULL) { > @@ -1352,7 +1352,7 @@ int amdgpu_cs_wait_fences_ioctl(struct > drm_device *dev, void *data, > if (fences == NULL) > return -ENOMEM; > > - fences_user = (void __user *)(uintptr_t)(wait->in.fences); > + fences_user = u64_to_user_ptr(wait->in.fences); > if (copy_from_user(fences, fences_user, > sizeof(struct drm_amdgpu_fence) * fence_count)) { > r = -EFAULT; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c > index 917ac5e..88085e7 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c > @@ -689,7 +689,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, > void *data, > switch (args->op) { > case AMDGPU_GEM_OP_GET_GEM_CREATE_INFO: { > struct drm_amdgpu_gem_create_in info; > - void __user *out = (void __user *)(uintptr_t)args->value; > + void __user *out = u64_to_user_ptr(args->value); > > info.bo_size = robj->gem_base.size; > info.alignment = robj->tbo.mem.page_alignment << > PAGE_SHIFT; > -- > 2.7.4 > > _______________________________________________ > amd-gfx mailing list > amd-gfx at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx