linux/drivers/uio
Linus Torvalds 498e47cd1d Fix build errors due to new UIO_MEM_DMA_COHERENT mess
Commit 576882ef5e ("uio: introduce UIO_MEM_DMA_COHERENT type")
introduced a new use-case for 'struct uio_mem' where the 'mem' field now
contains a kernel virtual address when 'memtype' is set to
UIO_MEM_DMA_COHERENT.

That in turn causes build errors, because 'mem' is of type
'phys_addr_t', and a virtual address is a pointer type.  When the code
just blindly uses cast to mix the two, it caused problems when
phys_addr_t isn't the same size as a pointer - notably on 32-bit
architectures with PHYS_ADDR_T_64BIT.

The proper thing to do would probably be to use a union member, and not
have any casts, and make the 'mem' member be a union of 'mem.physaddr'
and 'mem.vaddr', based on 'memtype'.

This is not that proper thing.  This is just fixing the ugly casts to be
even uglier, but at least not cause build errors on 32-bit platforms
with 64-bit physical addresses.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Fixes: 576882ef5e ("uio: introduce UIO_MEM_DMA_COHERENT type")
Fixes: 7722151e46 ("uio_pruss: UIO_MEM_DMA_COHERENT conversion")
Fixes: 019947805a ("uio_dmem_genirq: UIO_MEM_DMA_COHERENT conversion")
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Chris Leech <cleech@redhat.com>
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linus Torvalds <torvalds@linuxfoundation.org>
2024-03-27 09:48:47 -07:00
..
Kconfig uio: Remove leading spaces in Kconfig 2021-05-21 14:52:37 +02:00
Makefile uio: uio_dfl: add userspace i/o driver for DFL bus 2021-03-28 14:58:18 +02:00
uio_aec.c uio: uio_aec: Use pci_iounmap instead of iounmap 2021-05-14 13:39:47 +02:00
uio_cif.c uio: uio_cif: use devm_kzalloc() for uio_info object 2020-12-09 19:59:00 +01:00
uio_dfl.c uio: dfl: add vendor-specific feature id 2023-05-31 19:00:37 +01:00
uio_dmem_genirq.c Fix build errors due to new UIO_MEM_DMA_COHERENT mess 2024-03-27 09:48:47 -07:00
uio_fsl_elbc_gpcm.c uio: uio_fsl_elbc_gpcm: Replace NO_IRQ by 0 2022-11-10 18:39:19 +01:00
uio_hv_generic.c Drivers: hv: Make remove callback of hyperv driver void returned 2023-01-17 13:41:27 +00:00
uio_mf624.c uio: uio_mf624: use devm_kzalloc() for uio_info object 2020-12-09 19:58:54 +01:00
uio_netx.c uio: uio_netx: use devm_kzalloc() for or uio_info object 2020-12-09 19:58:54 +01:00
uio_pci_generic.c Merge 50f09a3dd5 ("Merge tag 'char-misc-5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc") into char-misc-next 2021-05-21 09:48:31 +02:00
uio_pdrv_genirq.c Merge branch 'char-misc-linus' into 'char-misc-next' 2020-07-10 13:42:33 +02:00
uio_pruss.c Fix build errors due to new UIO_MEM_DMA_COHERENT mess 2024-03-27 09:48:47 -07:00
uio_sercos3.c uio: uio_sercos3: use device-managed functions for simple allocs 2020-12-09 19:58:54 +01:00
uio.c Fix build errors due to new UIO_MEM_DMA_COHERENT mess 2024-03-27 09:48:47 -07:00