From: Stephen Hemminger <stephen@networkplumber.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Stephen Hemminger <sthemmin@microsoft.com>,
netdev@vger.kernel.org, Haiyang Zhang <haiyangz@microsoft.com>,
linux-kernel@vger.kernel.org, devel@linuxdriverproject.org
Subject: Re: [PATCH] uio-hv-generic: store physical addresses instead of virtual
Date: Fri, 9 Dec 2016 09:28:44 -0800 [thread overview]
Message-ID: <20161209092844.75b73e8d@xeon-e3> (raw)
In-Reply-To: <20161209114456.3719619-1-arnd@arndb.de>
On Fri, 9 Dec 2016 12:44:40 +0100
Arnd Bergmann <arnd@arndb.de> 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 <arnd@arndb.de>
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 <sthemmin@microsoft.com>
next prev parent reply other threads:[~2016-12-09 17:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-09 11:44 [PATCH] uio-hv-generic: store physical addresses instead of virtual Arnd Bergmann
2016-12-09 17:28 ` Stephen Hemminger [this message]
2016-12-09 20:38 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161209092844.75b73e8d@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=arnd@arndb.de \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=haiyangz@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sthemmin@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).