From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH v2 3/4] x86/fpu: Fix __user annotations Date: Fri, 29 Mar 2019 19:42:08 +0000 Message-ID: <20190329194208.GE2217@ZenIV.linux.org.uk> References: <20190329163047.223508-1-jannh@google.com> <20190329163047.223508-3-jannh@google.com> <20190329180329.hl3t7a43sg3sshsf@ltop.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Jann Horn Cc: Luc Van Oostenryck , linux-sparse@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , the arch/x86 maintainers , kernel list , Qiaowei Ren List-Id: linux-sparse@vger.kernel.org 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.