diff options
author | Arnd Bergmann <arnd@arndb.de> | 2015-10-07 03:41:27 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-10-07 09:59:18 -0400 |
commit | 028423b0d8fa27c30a46da4af2a5cab230369de6 (patch) | |
tree | 6181d44b0dc211d3a846d95aacbb7f1e3bd9c11f | |
parent | 9a65e6866f039ff029acffc05195d54bc6ca6aeb (diff) |
drm/amdgpu: fix 32-bit compiler warning
The new amdgpu driver passes a user space pointer in a 64-bit structure
member, which is the correct way to do it, but it attempts to
directly cast it to a __user pointer in the kernel, which causes
a warning in three places:
drm/amd/amdgpu/amdgpu_cs.c: In function 'amdgpu_cs_parser_init':
drm/amd/amdgpu/amdgpu_cs.c:180:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
chunk_array_user = (uint64_t __user *)(cs->in.chunks);
This changes all three to add an intermediate cast to 'unsigned long'
as other drivers do. This avoids the warning and works correctly on
both 32-bit and 64-bit architectures.
Fixes: e60b344f6c0eff ("drm/amdgpu: optimize amdgpu_parser_init")
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index cb3c274edb0a..fd16652aa277 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -177,7 +177,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) | |||
177 | 177 | ||
178 | /* get chunks */ | 178 | /* get chunks */ |
179 | INIT_LIST_HEAD(&p->validated); | 179 | INIT_LIST_HEAD(&p->validated); |
180 | chunk_array_user = (uint64_t __user *)(cs->in.chunks); | 180 | chunk_array_user = (uint64_t __user *)(unsigned long)(cs->in.chunks); |
181 | if (copy_from_user(chunk_array, chunk_array_user, | 181 | if (copy_from_user(chunk_array, chunk_array_user, |
182 | sizeof(uint64_t)*cs->in.num_chunks)) { | 182 | sizeof(uint64_t)*cs->in.num_chunks)) { |
183 | ret = -EFAULT; | 183 | ret = -EFAULT; |
@@ -197,7 +197,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) | |||
197 | struct drm_amdgpu_cs_chunk user_chunk; | 197 | struct drm_amdgpu_cs_chunk user_chunk; |
198 | uint32_t __user *cdata; | 198 | uint32_t __user *cdata; |
199 | 199 | ||
200 | chunk_ptr = (void __user *)chunk_array[i]; | 200 | chunk_ptr = (void __user *)(unsigned long)chunk_array[i]; |
201 | if (copy_from_user(&user_chunk, chunk_ptr, | 201 | if (copy_from_user(&user_chunk, chunk_ptr, |
202 | sizeof(struct drm_amdgpu_cs_chunk))) { | 202 | sizeof(struct drm_amdgpu_cs_chunk))) { |
203 | ret = -EFAULT; | 203 | ret = -EFAULT; |
@@ -208,7 +208,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) | |||
208 | p->chunks[i].length_dw = user_chunk.length_dw; | 208 | p->chunks[i].length_dw = user_chunk.length_dw; |
209 | 209 | ||
210 | size = p->chunks[i].length_dw; | 210 | size = p->chunks[i].length_dw; |
211 | cdata = (void __user *)user_chunk.chunk_data; | 211 | cdata = (void __user *)(unsigned long)user_chunk.chunk_data; |
212 | p->chunks[i].user_ptr = cdata; | 212 | p->chunks[i].user_ptr = cdata; |
213 | 213 | ||
214 | p->chunks[i].kdata = drm_malloc_ab(size, sizeof(uint32_t)); | 214 | p->chunks[i].kdata = drm_malloc_ab(size, sizeof(uint32_t)); |