All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leonro@nvidia.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	Bernard Metzler <BMT@zurich.ibm.com>,
	<linux-rdma@vger.kernel.org>
Subject: Re: [PATCH v3] RDMA/siw: Pass a pointer to virt_to_page()
Date: Sun, 4 Sep 2022 10:22:44 +0300	[thread overview]
Message-ID: <YxRSRIOs3gEEAyGN@unreal> (raw)
In-Reply-To: <20220902215918.603761-1-linus.walleij@linaro.org>

On Fri, Sep 02, 2022 at 11:59:18PM +0200, Linus Walleij wrote:
> 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: b9be6f18cf9e ("rdma/siw: transmit path")
> Cc: linux-rdma@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v2->v3:
> - Add Fixes: tag.
> ChangeLog v1->v2:
> - Change the local va variable to be uintptr_t, avoiding
>   double casts in two spots.
> ---
>  drivers/infiniband/sw/siw/siw_qp_tx.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 

Thanks, applied.

      reply	other threads:[~2022-09-04  7:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 21:59 [PATCH v3] RDMA/siw: Pass a pointer to virt_to_page() Linus Walleij
2022-09-04  7:22 ` Leon Romanovsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YxRSRIOs3gEEAyGN@unreal \
    --to=leonro@nvidia.com \
    --cc=BMT@zurich.ibm.com \
    --cc=jgg@nvidia.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.