Re: [PATCH v2 3/4] x86/fpu: Fix __user annotations
From: Al Viro
Date: Fri Mar 29 2019 - 15:42:19 EST
On Fri, Mar 29, 2019 at 08:25:25PM +0100, Jann Horn wrote:
> Oooh, it's a sparse bug.
It's *not* a bug.
> Apparently it's significant that the user pointer is stored as a
> __u64, and __u64 is defined as unsigned long long.
Yes, it is. Casts to uintptr_t (== unsigned long on all targets)
are OK; any other arithmetical type gives a warning, and quite
deliberately so.
Don't do it. If you want to say "I'm converting it to integer,
all traces of its origin are gone", use an idiomatic cast.