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


Groups > linux.kernel > #1475461

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

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [Linaro-mm-sig] [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps
Date 2016-09-02 23:40 +0200
Message-ID <sd4lP-4MR-5@gated-at.bofh.it> (permalink)
References <scJU5-8tP-9@gated-at.bofh.it> <sd4c9-4JR-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web