From: Laura Abbott <labbott@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>, linaro-mm-sig@lists.linaro.org
Cc: "kbuild test robot" <lkp@intel.com>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
devel@driverdev.osuosl.org, "Jon Medhurst" <tixy@linaro.org>,
"Android Kernel Team" <kernel-team@android.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jeremy Gebben" <jgebben@codeaurora.org>,
"Liviu Dudau" <Liviu.Dudau@arm.com>,
"Arve Hjønnevåg" <arve@android.com>,
linux-kernel@vger.kernel.org,
"Riley Andrews" <riandrews@android.com>,
"John Stultz" <john.stultz@linaro.org>,
kbuild-all@01.org, "Eun Taik Lee" <eun.taik.lee@samsung.com>,
"Chen Feng" <puck.chen@hisilicon.com>,
"Brian Starkey" <brian.starkey@arm.com>
Subject: Re: [Linaro-mm-sig] [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps
Date: Fri, 2 Sep 2016 14:53:52 -0700 [thread overview]
Message-ID: <89e914cc-e050-a901-1674-e9efcd53a981@redhat.com> (raw)
In-Reply-To: <5771220.ipmQs8UScq@wuerfel>
On 09/02/2016 02:37 PM, Arnd Bergmann wrote:
> On Friday, September 2, 2016 2:27:21 PM CEST Laura Abbott wrote:
>>>
>>> All warnings (new ones prefixed by >>):
>>>
>>> drivers/staging/android/ion/ion.c: In function 'ion_query_heaps':
>>>>> drivers/staging/android/ion/ion.c:1181:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>>> (struct ion_heap_data __user *)query->heaps;
>>> ^
>>>
>>
>> botching-up-ioctls.txt says:
>>
>> * Pointers are __u64, cast from/to a uintprt_t on the userspace side and
>> from/to a void __user * in the kernel. Try really hard not to delay this
>> conversion or worse, fiddle the raw __u64 through your code since that
>> diminishes the checking tools like sparse can provide.
>>
>> This doesn't seem like it will work on 32-bit systems since you'll end up
>> with the warning above. Is there a better option or did I misunderstand
>> how that is supposed to work?
>>
>
> I don't know a better way that two cast, doing
>
> (struct ion_heap_data __user *)(uintptr_t)query->heaps;
>
> It may help to put this into an inline function though.
>
> Arnd
>
There already is one it turns out in kernel.h:
#define u64_to_user_ptr(x) ( \
{ \
typecheck(u64, x); \
(void __user *)(uintptr_t)x; \
} \
)
At least this way I don't have to look at the double casts.
Thanks,
Laura
next prev parent reply other threads:[~2016-09-02 21:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-01 22:40 [PATCHv2 0/4] New Ion ioctls Laura Abbott
2016-09-01 22:40 ` [PATCHv2 1/4] staging: android: ion: Drop heap type masks Laura Abbott
2016-09-02 13:41 ` Brian Starkey
2016-09-02 19:36 ` Laura Abbott
2016-09-05 11:20 ` Brian Starkey
2016-09-06 22:16 ` Laura Abbott
2016-09-07 8:50 ` Brian Starkey
2016-09-01 22:40 ` [PATCHv2 2/4] staging: android: ion: Pull out ion ioctls to a separate file Laura Abbott
2016-09-02 12:44 ` Greg Kroah-Hartman
2016-09-02 19:53 ` Laura Abbott
2016-09-01 22:40 ` [PATCHv2 3/4] staging: android: ion: Add an ioctl for ABI checking Laura Abbott
2016-09-02 6:10 ` Greg Kroah-Hartman
2016-09-02 20:26 ` Laura Abbott
2016-09-02 9:02 ` [Linaro-mm-sig] " Arnd Bergmann
2016-09-02 20:33 ` Laura Abbott
2016-09-02 21:33 ` Arnd Bergmann
2016-09-02 22:14 ` Laura Abbott
2016-09-01 22:40 ` [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps Laura Abbott
2016-09-01 23:44 ` kbuild test robot
2016-09-02 21:27 ` Laura Abbott
2016-09-02 21:37 ` [Linaro-mm-sig] " Arnd Bergmann
2016-09-02 21:53 ` Laura Abbott [this message]
2016-09-02 6:14 ` Greg Kroah-Hartman
2016-09-02 20:41 ` Laura Abbott
2016-09-03 12:55 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=89e914cc-e050-a901-1674-e9efcd53a981@redhat.com \
--to=labbott@redhat.com \
--cc=Liviu.Dudau@arm.com \
--cc=arnd@arndb.de \
--cc=arve@android.com \
--cc=brian.starkey@arm.com \
--cc=daniel.vetter@ffwll.ch \
--cc=devel@driverdev.osuosl.org \
--cc=eun.taik.lee@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=jgebben@codeaurora.org \
--cc=john.stultz@linaro.org \
--cc=kbuild-all@01.org \
--cc=kernel-team@android.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=puck.chen@hisilicon.com \
--cc=riandrews@android.com \
--cc=tixy@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).