Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1241285
| From | Chris Wilson <chris@chris-wilson.co.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] drm/amdgpu: fix 32-bit compiler warning |
| Date | 2015-10-07 11:30 +0200 |
| Message-ID | <qgTcS-DX-33@gated-at.bofh.it> (permalink) |
| References | <qgRE5-6LB-1@gated-at.bofh.it> <qgT3c-st-39@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Oct 07, 2015 at 10:57:11AM +0200, Christian König wrote:
> On 07.10.2015 09:41, Arnd Bergmann wrote:
> >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.
> >
> >Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Well if I'm not completely mistaken this is the second time we need
> to fix this because somebody thought the cast was unnecessary.
>
> Anyway the patch is Reviewed-by: Christian König
> <christian.koenig@amd.com> and I'm going to keep an eye open for the
> next time somebody tries to remove this.
We use
static inline void __user *to_user_ptr(u64 address)
{
return (void __user *)(uintptr_t)address;
}
to make the intention clear and hide the cast from prying eyes.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] drm/amdgpu: fix 32-bit compiler warning Arnd Bergmann <arnd@arndb.de> - 2015-10-07 09:50 +0200
Re: [PATCH] drm/amdgpu: fix 32-bit compiler warning Arnd Bergmann <arnd@arndb.de> - 2015-10-07 11:20 +0200
Re: [PATCH] drm/amdgpu: fix 32-bit compiler warning Alex Deucher <alexdeucher@gmail.com> - 2015-10-07 16:10 +0200
Re: [PATCH] drm/amdgpu: fix 32-bit compiler warning Chris Wilson <chris@chris-wilson.co.uk> - 2015-10-07 11:30 +0200
csiph-web