All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/netback: Pass (void *) to virt_to_page()
@ 2023-05-23 14:03 Linus Walleij
  2023-05-23 15:15 ` Wei Liu
  2023-05-25  5:11 ` Jakub Kicinski
  0 siblings, 2 replies; 6+ messages in thread
From: Linus Walleij @ 2023-05-23 14:03 UTC (permalink / raw)
  To: Wei Liu, Paul Durrant; +Cc: xen-devel, netdev, Linus Walleij

virt_to_page() takes a virtual address as argument but
the driver passes an unsigned long, which works because
the target platform(s) uses polymorphic macros to calculate
the page.

Since many architectures implement virt_to_pfn() as
a macro, this function becomes polymorphic and accepts both a
(unsigned long) and a (void *).

Fix this up by an explicit (void *) cast.

Cc: Wei Liu <wei.liu@kernel.org>
Cc: Paul Durrant <paul@xen.org>
Cc: xen-devel@lists.xenproject.org
Cc: netdev@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/net/xen-netback/netback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index c1501f41e2d8..caf0c815436c 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -689,7 +689,7 @@ static void xenvif_fill_frags(struct xenvif_queue *queue, struct sk_buff *skb)
 		prev_pending_idx = pending_idx;
 
 		txp = &queue->pending_tx_info[pending_idx].req;
-		page = virt_to_page(idx_to_kaddr(queue, pending_idx));
+		page = virt_to_page((void *)idx_to_kaddr(queue, pending_idx));
 		__skb_fill_page_desc(skb, i, page, txp->offset, txp->size);
 		skb->len += txp->size;
 		skb->data_len += txp->size;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/netback: Pass (void *) to virt_to_page()
  2023-05-23 14:03 [PATCH] xen/netback: Pass (void *) to virt_to_page() Linus Walleij
@ 2023-05-23 15:15 ` Wei Liu
  2023-05-25  5:11 ` Jakub Kicinski
  1 sibling, 0 replies; 6+ messages in thread
From: Wei Liu @ 2023-05-23 15:15 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Wei Liu, Paul Durrant, xen-devel, netdev

On Tue, May 23, 2023 at 04:03:42PM +0200, Linus Walleij wrote:
> virt_to_page() takes a virtual address as argument but
> the driver passes an unsigned long, which works because
> the target platform(s) uses polymorphic macros to calculate
> the page.
> 
> Since many architectures implement virt_to_pfn() as
> a macro, this function becomes polymorphic and accepts both a
> (unsigned long) and a (void *).
> 
> Fix this up by an explicit (void *) cast.
> 
> Cc: Wei Liu <wei.liu@kernel.org>
> Cc: Paul Durrant <paul@xen.org>
> Cc: xen-devel@lists.xenproject.org
> Cc: netdev@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Acked-by: Wei Liu <wei.liu@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/netback: Pass (void *) to virt_to_page()
  2023-05-23 14:03 [PATCH] xen/netback: Pass (void *) to virt_to_page() Linus Walleij
  2023-05-23 15:15 ` Wei Liu
@ 2023-05-25  5:11 ` Jakub Kicinski
  2023-05-25  5:12   ` Jakub Kicinski
  2023-05-26  2:49   ` Wei Liu
  1 sibling, 2 replies; 6+ messages in thread
From: Jakub Kicinski @ 2023-05-25  5:11 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Wei Liu, Paul Durrant, xen-devel, netdev

On Tue, 23 May 2023 16:03:42 +0200 Linus Walleij wrote:
> virt_to_page() takes a virtual address as argument but
> the driver passes an unsigned long, which works because
> the target platform(s) uses polymorphic macros to calculate
> the page.
> 
> Since many architectures implement virt_to_pfn() as
> a macro, this function becomes polymorphic and accepts both a
> (unsigned long) and a (void *).
> 
> Fix this up by an explicit (void *) cast.

Paul, Wei, looks like netdev may be the usual path for this patch 
to flow thru, although I'm never 100% sure with Xen.
Please ack or LUK if you prefer to direct the patch elsewhere?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/netback: Pass (void *) to virt_to_page()
  2023-05-25  5:11 ` Jakub Kicinski
@ 2023-05-25  5:12   ` Jakub Kicinski
  2023-05-25 13:47     ` Linus Walleij
  2023-05-26  2:49   ` Wei Liu
  1 sibling, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2023-05-25  5:12 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Wei Liu, Paul Durrant, xen-devel, netdev

On Wed, 24 May 2023 22:11:47 -0700 Jakub Kicinski wrote:
> On Tue, 23 May 2023 16:03:42 +0200 Linus Walleij wrote:
> > virt_to_page() takes a virtual address as argument but
> > the driver passes an unsigned long, which works because
> > the target platform(s) uses polymorphic macros to calculate
> > the page.
> > 
> > Since many architectures implement virt_to_pfn() as
> > a macro, this function becomes polymorphic and accepts both a
> > (unsigned long) and a (void *).
> > 
> > Fix this up by an explicit (void *) cast.  
> 
> Paul, Wei, looks like netdev may be the usual path for this patch 
> to flow thru, although I'm never 100% sure with Xen.
> Please ack or LUK if you prefer to direct the patch elsewhere?

Ugh, Wei already acked this, sorry for the noise.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/netback: Pass (void *) to virt_to_page()
  2023-05-25  5:12   ` Jakub Kicinski
@ 2023-05-25 13:47     ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2023-05-25 13:47 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: Wei Liu, Paul Durrant, xen-devel, netdev

On Thu, May 25, 2023 at 7:12 AM Jakub Kicinski <kuba@kernel.org> wrote:
> On Wed, 24 May 2023 22:11:47 -0700 Jakub Kicinski wrote:
> > On Tue, 23 May 2023 16:03:42 +0200 Linus Walleij wrote:
> > > virt_to_page() takes a virtual address as argument but
> > > the driver passes an unsigned long, which works because
> > > the target platform(s) uses polymorphic macros to calculate
> > > the page.
> > >
> > > Since many architectures implement virt_to_pfn() as
> > > a macro, this function becomes polymorphic and accepts both a
> > > (unsigned long) and a (void *).
> > >
> > > Fix this up by an explicit (void *) cast.
> >
> > Paul, Wei, looks like netdev may be the usual path for this patch
> > to flow thru, although I'm never 100% sure with Xen.
> > Please ack or LUK if you prefer to direct the patch elsewhere?
>
> Ugh, Wei already acked this, sorry for the noise.

Don't worry about it Jakub, it's queued in the asm-generic tree
along with patches making things give nasty compile messages
if they are not typed right, we try to keep down the level of noise
this way: silence it while fixing the root cause.

If you prefer to take it into the net tree that works too but no need.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/netback: Pass (void *) to virt_to_page()
  2023-05-25  5:11 ` Jakub Kicinski
  2023-05-25  5:12   ` Jakub Kicinski
@ 2023-05-26  2:49   ` Wei Liu
  1 sibling, 0 replies; 6+ messages in thread
From: Wei Liu @ 2023-05-26  2:49 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: Linus Walleij, Wei Liu, Paul Durrant, xen-devel, netdev

On Wed, May 24, 2023 at 10:11:47PM -0700, Jakub Kicinski wrote:
> On Tue, 23 May 2023 16:03:42 +0200 Linus Walleij wrote:
> > virt_to_page() takes a virtual address as argument but
> > the driver passes an unsigned long, which works because
> > the target platform(s) uses polymorphic macros to calculate
> > the page.
> > 
> > Since many architectures implement virt_to_pfn() as
> > a macro, this function becomes polymorphic and accepts both a
> > (unsigned long) and a (void *).
> > 
> > Fix this up by an explicit (void *) cast.
> 
> Paul, Wei, looks like netdev may be the usual path for this patch 
> to flow thru, although I'm never 100% sure with Xen.

Yes. Netdev is the right path.

Thanks,
Wei.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-26  2:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23 14:03 [PATCH] xen/netback: Pass (void *) to virt_to_page() Linus Walleij
2023-05-23 15:15 ` Wei Liu
2023-05-25  5:11 ` Jakub Kicinski
2023-05-25  5:12   ` Jakub Kicinski
2023-05-25 13:47     ` Linus Walleij
2023-05-26  2:49   ` Wei Liu

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.