lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 15 Dec 2022 17:59:23 +0000
From:   Bernard Metzler <BMT@...ich.ibm.com>
To:     Arnd Bergmann <arnd@...nel.org>, Jason Gunthorpe <jgg@...pe.ca>,
        Leon Romanovsky <leon@...nel.org>,
        Linus Walleij <linus.walleij@...aro.org>
CC:     Arnd Bergmann <arnd@...db.de>,
        "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] RDMA/siw: fix pointer cast warning



> -----Original Message-----
> From: Arnd Bergmann <arnd@...nel.org>
> Sent: Thursday, 15 December 2022 18:04
> To: Bernard Metzler <BMT@...ich.ibm.com>; Jason Gunthorpe <jgg@...pe.ca>;
> Leon Romanovsky <leon@...nel.org>; Linus Walleij <linus.walleij@...aro.org>
> Cc: Arnd Bergmann <arnd@...db.de>; linux-rdma@...r.kernel.org; linux-
> kernel@...r.kernel.org
> Subject: [EXTERNAL] [PATCH] RDMA/siw: fix pointer cast warning
> 
> From: Arnd Bergmann <arnd@...db.de>
> 
> The previous build fix left a remaining issue in configurations
> with 64-bit dma_addr_t on 32-bit architectures:
> 
> drivers/infiniband/sw/siw/siw_qp_tx.c: In function 'siw_get_pblpage':
> drivers/infiniband/sw/siw/siw_qp_tx.c:32:37: error: cast to pointer from
> integer of different size [-Werror=int-to-pointer-cast]
>    32 |                 return virt_to_page((void *)paddr);
>       |                                     ^
> 
> Use the same double cast here that the driver uses elsewhere
> to convert between dma_addr_t and void*.
> 
> It took me a while to figure out why this driver does it
> like this, as there is no hardware access and it just stores
> kernel pointers in place of device addresses when communicating
> with the rdma core and with user space.
> 
> Fixes: 0d1b756acf60 ("RDMA/siw: Pass a pointer to virt_to_page()")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  drivers/infiniband/sw/siw/siw_qp_tx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c
> b/drivers/infiniband/sw/siw/siw_qp_tx.c
> index 7d47b521070b..05052b49107f 100644
> --- a/drivers/infiniband/sw/siw/siw_qp_tx.c
> +++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
> @@ -29,7 +29,7 @@ static struct page *siw_get_pblpage(struct siw_mem *mem,
> u64 addr, int *idx)
>  	dma_addr_t paddr = siw_pbl_get_buffer(pbl, offset, NULL, idx);
> 
>  	if (paddr)
> -		return virt_to_page((void *)paddr);
> +		return virt_to_page((void *)(uintptr_t)paddr);
> 
>  	return NULL;
>  }

Thanks Arnd, makes complete sense.

Acked-by: Bernard Metzler <bmt@...ich.ibm.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ