lkml.org 
[lkml]   [2018]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v6 11/11] arm64: annotate user pointers casts detected by sparse
On Thu, Sep 6, 2018 at 2:13 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> So for example:
>
> > static inline compat_uptr_t ptr_to_compat(void __user *uptr)
> > {
> > - return (u32)(unsigned long)uptr;
> > + return (u32)(__force unsigned long)uptr;
> > }
>
> this actually looks correct.

Side note: I do think that while the above is correct, the rest of the
patch shows that we might be better off simply not havign the warning
for address space changes at all for the "cast a pointer to an integer
type" case.

When you cast to a non-pointer type, the address space issue simply
doesn't exist at all, so the warning makes less sense.

It's really just he "pointer to one address space" being cast to
"pointer to another address space" that should really warn, and that
might need that "__force" thing.

Hmm? So maybe a sparse change is better for most of that patch.

Linus

\
 
 \ /
  Last update: 2018-09-06 23:16    [W:0.126 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site