mirror_ubuntu-kernels/drivers/infiniband/sw/siw
Linus Walleij 0d1b756acf RDMA/siw: Pass a pointer to virt_to_page()
Functions that work on a pointer to virtual memory such as
virt_to_pfn() and users of that function such as
virt_to_page() are supposed to pass a pointer to virtual
memory, ideally a (void *) or other pointer. However since
many architectures implement virt_to_pfn() as a macro,
this function becomes polymorphic and accepts both a
(unsigned long) and a (void *).

If we instead implement a proper virt_to_pfn(void *addr)
function the following happens (occurred on arch/arm):

drivers/infiniband/sw/siw/siw_qp_tx.c:32:23: warning: incompatible
  integer to pointer conversion passing 'dma_addr_t' (aka 'unsigned int')
  to parameter of type 'const void *' [-Wint-conversion]
drivers/infiniband/sw/siw/siw_qp_tx.c:32:37: warning: passing argument
  1 of 'virt_to_pfn' makes pointer from integer without a cast
  [-Wint-conversion]
drivers/infiniband/sw/siw/siw_qp_tx.c:538:36: warning: incompatible
  integer to pointer conversion passing 'unsigned long long'
  to parameter of type 'const void *' [-Wint-conversion]

Fix this with an explicit cast. In one case where the SIW
SGE uses an unaligned u64 we need a double cast modifying the
virtual address (va) to a platform-specific uintptr_t before
casting to a (void *).

Fixes: b9be6f18cf ("rdma/siw: transmit path")
Cc: linux-rdma@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220902215918.603761-1-linus.walleij@linaro.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-09-04 10:21:59 +03:00
..
iwarp.h RDMA: Delete not-used static inline functions 2021-03-22 09:31:19 -03:00
Kconfig RDMA/core: remove use of dma_virt_ops 2020-11-17 15:22:07 -04:00
Makefile
siw_cm.c RDMA/siw: Fix duplicated reported IW_CM_EVENT_CONNECT_REPLY event 2022-07-18 14:20:52 +03:00
siw_cm.h
siw_cq.c RDMA/siw: Simplify QP representation 2020-01-03 15:54:09 -04:00
siw_main.c RDMA/siw: Enable siw on tunnel devices 2022-05-11 13:52:38 -03:00
siw_mem.c RDMA/siw: Fix a use after free in siw_alloc_mr 2021-04-27 15:19:21 -03:00
siw_mem.h RDMA: Delete not-used static inline functions 2021-03-22 09:31:19 -03:00
siw_qp_rx.c RDMA/siw: Fix broken RDMA Read Fence/Resume logic. 2022-02-01 09:54:28 -04:00
siw_qp_tx.c RDMA/siw: Pass a pointer to virt_to_page() 2022-09-04 10:21:59 +03:00
siw_qp.c RDMA: Globally allocate and release QP memory 2021-08-03 13:44:27 -03:00
siw_verbs.c RDMA: remove useless condition in siw_create_cq() 2022-07-18 12:27:28 +03:00
siw_verbs.h RDMA: Globally allocate and release QP memory 2021-08-03 13:44:27 -03:00
siw.h RDMA/siw: Fix broken RDMA Read Fence/Resume logic. 2022-02-01 09:54:28 -04:00