From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934155AbcLIR2y (ORCPT ); Fri, 9 Dec 2016 12:28:54 -0500 Received: from mail-pf0-f176.google.com ([209.85.192.176]:35797 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934117AbcLIR2w (ORCPT ); Fri, 9 Dec 2016 12:28:52 -0500 Date: Fri, 9 Dec 2016 09:28:44 -0800 From: Stephen Hemminger To: Arnd Bergmann Cc: Greg Kroah-Hartman , Stephen Hemminger , netdev@vger.kernel.org, Haiyang Zhang , linux-kernel@vger.kernel.org, devel@linuxdriverproject.org Subject: Re: [PATCH] uio-hv-generic: store physical addresses instead of virtual Message-ID: <20161209092844.75b73e8d@xeon-e3> In-Reply-To: <20161209114456.3719619-1-arnd@arndb.de> References: <20161209114456.3719619-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 9 Dec 2016 12:44:40 +0100 Arnd Bergmann wrote: > gcc warns about the newly added driver when phys_addr_t is wider than > a pointer: > > drivers/uio/uio_hv_generic.c: In function 'hv_uio_mmap': > drivers/uio/uio_hv_generic.c:71:17: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] > virt_to_phys((void *)info->mem[mi].addr) >> PAGE_SHIFT, > drivers/uio/uio_hv_generic.c: In function 'hv_uio_probe': > drivers/uio/uio_hv_generic.c:140:5: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] > = (phys_addr_t)dev->channel->ringbuffer_pages; > drivers/uio/uio_hv_generic.c:147:3: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] > (phys_addr_t)vmbus_connection.int_page; > drivers/uio/uio_hv_generic.c:153:3: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] > (phys_addr_t)vmbus_connection.monitor_pages[1]; > > I can't see why we store a virtual address in a phys_addr_t here, > as the only user of that variable converts it into a physical > address anyway, so this moves the conversion to where it logically > fits according to the types. > > Fixes: 95096f2fbd10 ("uio-hv-generic: new userspace i/o driver for VMBus") > Signed-off-by: Arnd Bergmann Thanks, the code was inherited from outside, and only tested on x86_64. Not sure which platform and GCC version generates the warning, was this just W=1? Acked-by: Stephen Hemminger