]> www.infradead.org Git - users/jedix/linux-maple.git/commit
uio-hv-generic: store physical addresses instead of virtual
authorArnd Bergmann <arnd@arndb.de>
Fri, 9 Dec 2016 11:44:40 +0000 (12:44 +0100)
committerSomasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Thu, 31 Aug 2017 17:26:20 +0000 (10:26 -0700)
commita6d2d81cdcb5f641654adbf58714d4f6cc03d4c2
tree39baf3c5f41e316509359f7ad34ddc36cba5f6ae
parent6cc0632c64ab358e1aec7a8d9207e6d8d7a6382c
uio-hv-generic: store physical addresses instead of virtual

Orabug: 26668113

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>
Acked-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 190cc65e912de7e8f7ebddcecfbf55a610281a8c)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
drivers/uio/uio_hv_generic.c