Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1475460 > unrolled thread

Re: [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps

Started byLaura Abbott <labbott@redhat.com>
First post2016-09-02 23:30 +0200
Last post2016-09-03 00:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCHv2 4/4] staging: android: ion: Add ioctl to query available  heaps Laura Abbott <labbott@redhat.com> - 2016-09-02 23:30 +0200
    Re: [Linaro-mm-sig] [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps Arnd Bergmann <arnd@arndb.de> - 2016-09-02 23:40 +0200
      Re: [Linaro-mm-sig] [PATCHv2 4/4] staging: android: ion: Add ioctl to  query available heaps Laura Abbott <labbott@redhat.com> - 2016-09-03 00:00 +0200

#1475460 — Re: [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps

FromLaura Abbott <labbott@redhat.com>
Date2016-09-02 23:30 +0200
SubjectRe: [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps
Message-ID<sd4c9-4JR-1@gated-at.bofh.it>
On 09/01/2016 04:44 PM, kbuild test robot wrote:
> Hi Laura,
>
> [auto build test WARNING on next-20160825]
> [cannot apply to staging/staging-testing v4.8-rc4 v4.8-rc3 v4.8-rc2 v4.8-rc4]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> [Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
> [Check https://git-scm.com/docs/git-format-patch for more information]
>
> url:    https://github.com/0day-ci/linux/commits/Laura-Abbott/staging-android-ion-Drop-heap-type-masks/20160902-071022
> config: mips-allyesconfig (attached as .config)
> compiler: mips-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=mips
>
> 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?

Thanks,
Laura

[toc] | [next] | [standalone]


#1475461 — Re: [Linaro-mm-sig] [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps

FromArnd Bergmann <arnd@arndb.de>
Date2016-09-02 23:40 +0200
SubjectRe: [Linaro-mm-sig] [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps
Message-ID<sd4lP-4MR-5@gated-at.bofh.it>
In reply to#1475460
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

[toc] | [prev] | [next] | [standalone]


#1475474 — Re: [Linaro-mm-sig] [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps

FromLaura Abbott <labbott@redhat.com>
Date2016-09-03 00:00 +0200
SubjectRe: [Linaro-mm-sig] [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps
Message-ID<sd4Fb-4T7-1@gated-at.bofh.it>
In reply to#1475461
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web