From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752490AbbJGJV7 (ORCPT ); Wed, 7 Oct 2015 05:21:59 -0400 Received: from mail.fireflyinternet.com ([87.106.93.118]:52048 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751444AbbJGJV5 (ORCPT ); Wed, 7 Oct 2015 05:21:57 -0400 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Date: Wed, 7 Oct 2015 10:21:01 +0100 From: Chris Wilson To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Arnd Bergmann , David Airlie , marek.olsak@amd.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Alex Deucher , "monk.liu" Subject: Re: [PATCH] drm/amdgpu: fix 32-bit compiler warning Message-ID: <20151007092101.GD27939@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Christian =?iso-8859-1?Q?K=F6nig?= , Arnd Bergmann , David Airlie , marek.olsak@amd.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Alex Deucher , "monk.liu" References: <14056299.vVOiOhUXfA@wuerfel> <5614DE67.2070507@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5614DE67.2070507@amd.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > 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 > 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