[PATCH 2/3] uio: Fix build failure on 32 bit builds with 64 bit physaddr
From: Guenter Roeck
Date: Sat Mar 23 2024 - 10:42:48 EST
Builds on 32-bit systems with 64 bit physical address fail with
drivers/uio/uio.c: In function 'uio_mmap_dma_coherent':
drivers/uio/uio.c:795:16: 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: 576882ef5e7f ("uio: introduce UIO_MEM_DMA_COHERENT type")
Cc: Chris Leech <cleech@xxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
---
drivers/uio/uio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index bb77de6fa067..1935b0f16477 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -792,7 +792,7 @@ static int uio_mmap_dma_coherent(struct vm_area_struct *vma)
*/
vma->vm_pgoff = 0;
- addr = (void *)mem->addr;
+ addr = (void *)(unsigned long)mem->addr;
ret = dma_mmap_coherent(mem->dma_device,
vma,
addr,
--
2.39.2