mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] uio_dmem_genirq: Fix build failure on 32 bit builds with 64 bit physaddr
@ 2024-03-23 14:42 Guenter Roeck
  2024-03-23 14:42 ` [PATCH 2/3] uio: " Guenter Roeck
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Guenter Roeck @ 2024-03-23 14:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Nilesh Javali, Christoph Hellwig, Guenter Roeck,
	Chris Leech

Builds on 32-bit systems with 64 bit physical address fail with

drivers/uio/uio_dmem_genirq.c: In function 'uio_dmem_genirq_open':
drivers/uio/uio_dmem_genirq.c:63:39: error:
	cast from pointer to integer of different size

drivers/uio/uio_dmem_genirq.c: In function 'uio_dmem_genirq_release':
drivers/uio/uio_dmem_genirq.c:92:43: error:
	cast to pointer from integer of different size

The conversion itself is safe since sizeof(phys_addr_t) it in general equal
to or larger than sizeof(void *). Solve the problem by double-casting the
conversion.

Fixes: 019947805a8d ("uio_dmem_genirq: UIO_MEM_DMA_COHERENT conversion")
Cc: Chris Leech <cleech@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/uio/uio_dmem_genirq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
index d5f9384df125..ac793e916f80 100644
--- a/drivers/uio/uio_dmem_genirq.c
+++ b/drivers/uio/uio_dmem_genirq.c
@@ -60,7 +60,7 @@ static int uio_dmem_genirq_open(struct uio_info *info, struct inode *inode)
 
 		addr = dma_alloc_coherent(&priv->pdev->dev, uiomem->size,
 					  &uiomem->dma_addr, GFP_KERNEL);
-		uiomem->addr = addr ? (phys_addr_t) addr : DMEM_MAP_ERROR;
+		uiomem->addr = addr ? (phys_addr_t)(unsigned long)addr : DMEM_MAP_ERROR;
 		++uiomem;
 	}
 	priv->refcnt++;
@@ -89,7 +89,7 @@ static int uio_dmem_genirq_release(struct uio_info *info, struct inode *inode)
 			break;
 		if (uiomem->addr) {
 			dma_free_coherent(uiomem->dma_device, uiomem->size,
-					  (void *) uiomem->addr,
+					  (void *)(unsigned long)uiomem->addr,
 					  uiomem->dma_addr);
 		}
 		uiomem->addr = DMEM_MAP_ERROR;
-- 
2.39.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-23 15:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-23 14:42 [PATCH 1/3] uio_dmem_genirq: Fix build failure on 32 bit builds with 64 bit physaddr Guenter Roeck
2024-03-23 14:42 ` [PATCH 2/3] uio: " Guenter Roeck
2024-03-23 14:42 ` [PATCH 3/3] uio_pruss: " Guenter Roeck
2024-03-23 15:36 ` [PATCH 1/3] uio_dmem_genirq: " Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®