From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934080AbbJIS4Z (ORCPT ); Fri, 9 Oct 2015 14:56:25 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:53209 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755947AbbJIS4X (ORCPT ); Fri, 9 Oct 2015 14:56:23 -0400 From: Arnd Bergmann To: Christoph Hellwig Cc: Matthew Wilcox , Jens Axboe , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, Christoph Hellwig Subject: Re: [PATCH] nvme: fix 32-bit build warning Date: Fri, 09 Oct 2015 20:55:26 +0200 Message-ID: <5008376.3nLbRZSJUc@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20151009144221.GA12760@infradead.org> References: <5851501.PBMrs03XFb@wuerfel> <20151009144221.GA12760@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:jzHHCYo1EwziF91ji7jpUEsGG1GQsQZR0n2Uf/+BUkInmlLd2yf o3TXVZWqcZSEQzWnxhNYt4Juy1NySA4mNX4/X8iA9U39b089HpEgNQaQw3duEUV+kuCG/Ys i8mIwOpuu0xFmzW+sEuF1BcyWPYR3qSASiy1xpFc/CGizBLtkp/rzpxf+tuBmetoCo7wyjh JMBbWMUmEzP36AnPG8L6A== X-UI-Out-Filterresults: notjunk:1;V01:K0:gEXFPYdrjGo=:PMFcHRqDf5Y6erJuS/dZcA XFYTTH3Av4J+uZT4rWcWQukvkV7DnNRLng7v43xbLYMZnhozkSJPzaR8aOZdjJT6HaoqJcXXs i2IQNnyv9zRgMnsn7U+dPe2BBAj6TBvryU32fWEXjIkU+LTH0h+axmtHB5RLA/QyRxBCsl/MU pWUHZZySE+9dPWLU4awxVDKi5Hy3PlMfPRnBYRcEZFWUuQFy0xTZImJpEGVNE2rortGl8cJ5/ GzM2//FI9BKchI5g+1ndG6f2BNBUC5SZwhnPgsvdoZ5qgG7qE+aZdT3i7HaZCrk5aWNxj2zsz VaElFyLGujb5H5G8YdBKQoBUuLUbfwkLC66LvYuuC57XSWP4mju0au8q2c3FIMf0Z2bvv8i3C yY+/K5cXeQuiP4Mq8iDq4frCJIxyaPTwguJykLNvfuNTaXCgzTL4mpfphS4pDthpnKawo9HbG zggYER8Dmp9FA5pTufU4yvVV3133zdfzghAslP9XVeRkZ/9o+IlbudAVJssJZvmwTtq7eW/Xb aK+Ngu5cVG82AgG5/e1i6Rlmp8dyXHNfSJlF8ponupSTkWsZDuM9eGDKEjL6RAv0PFGfdzmIG xi+6UR9NQcmeQozSNzVK92DDSUFr/npKhS4L3dyQvYImAGq7iV2QEAN8KIQm0h2KYTdsPzgEZ pHptaDvVzFcZ0mjuwUWCtS4RJuU4cWGifK9EUYOSMQxMt3TT1OE60QS71TjM1a5y5TZVBoq8l CVCb5rNJSUUm2bHN Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 09 October 2015 07:42:21 Christoph Hellwig wrote: > On Tue, Oct 06, 2015 at 10:37:11PM +0200, Arnd Bergmann wrote: > > Compiling the nvme driver on 32-bit warns about a cast from a __u64 > > variable to a pointer: > > > > drivers/block/nvme-core.c: In function 'nvme_submit_io': > > drivers/block/nvme-core.c:1847:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] > > (void __user *)io.addr, length, NULL, 0); > > > > The cast here is intentional and safe, so we can shut up the > > gcc warning by adding an intermediate cast to 'unsigned long'. > > It really should be a uintptr_t, which would also avoid the > 80 > character lines. I wonder if we need a u64_to_ptr helper given these > ioctl ABIs that pass pointers as a u64 seems to be everywhere these > days. I'll send a new version with uintptr_t for now, but having a proper interface for this sounds like a good idea. I've seen a couple of cases like this, and most but not all actually want a __user pointer like this one. That seems similar to the common ioctl use case where we want a user pointer from an 'unsigned long', so we could use the same function for both, like static inline void __user *get_uptr(unsigned long arg) { return (void __user *)arg; } With this definition, you can pass any scalar type (u64 or unsigned long normally) and get the pointer, and we can put that into include/linux/uaccess.h. Arnd