Skip to contentSkip to conversation

virtio-net: fix build on m68k and sparc64

PATCH In review Michael S. Tsirkin 2 participants 5 messages Jan 15, 2014

Subsystems (4)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 virtio-net: fix build on m68k and sparc64

As a result of backporting a bugfix, virtio_net started passing void * to page_address, assuming that it will get silently converted to struct page *. But this does not happen on architectures where page_address is a macro, the result is build failure as the macro tries to dereference void*.

Fix by reordering code slightly, so we always pass struct page * to page_address.

---

David, Greg asked that this be put in stable ASAP to avoid next release being broken.
I still didn't Cc stable directly as I know you prefer to do this yourself.
Sorry about creating this mess, could you help fast-path it there please?

Thanks!

 drivers/net/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/virtio_net.c +2 -2
index b8665588..c8d5ee1 100644
@@ -330,9 +330,9 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
 					 void *buf,
 					 unsigned int len)
 {
-	struct skb_vnet_hdr *hdr = page_address(buf);
-	int num_buf = hdr->mhdr.num_buffers;
 	struct page *page = buf;
+	struct skb_vnet_hdr *hdr = page_address(page);
+	int num_buf = hdr->mhdr.num_buffers;
 	struct sk_buff *skb = page_to_skb(rq, page, len);
 	int i;
 
Signature · 1 line
MST
#1 lore raw
Quoted 8 lines · Michael S. Tsirkin

As a result of backporting a bugfix, virtio_net started passing void * to page_address, assuming that it will get silently converted to struct page *. But this does not happen on architectures where page_address is a macro, the result is build failure as the macro tries to dereference void*.

Fix by reordering code slightly, so we always pass struct page * to page_address.

Thanks for the clue! I was just investigating a similar failure in -next.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#2 lore raw
Quoted 7 lines · Geert Uytterhoeven
Quoted 6 lines · Michael S. Tsirkin

As a result of backporting a bugfix, virtio_net started passing void * to page_address, assuming that it will get silently converted to struct page *. But this does not happen on architectures where page_address is a macro, the result is build failure as the macro tries to dereference void*.

Quoted 8 lines
Quoted 2 lines

Fix by reordering code slightly, so we always pass struct page * to page_address.

Thanks for the clue! I was just investigating a similar failure in -next.

Gr{oetje,eeting}s,

Geert

You don't mean linux-next? And not in virtio-net? I don't see page_address being used on void * anywhere there.

Quoted 6 lines

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Geert Uytterhoeven
Quoted 8 lines · Michael S. Tsirkin

As a result of backporting a bugfix, virtio_net started passing void * to page_address, assuming that it will get silently converted to struct page *. But this does not happen on architectures where page_address is a macro, the result is build failure as the macro tries to dereference void*.

Fix by reordering code slightly, so we always pass struct page * to page_address.

Quoted 8 lines
Quoted 5 lines

Thanks for the clue! I was just investigating a similar failure in -next.

Gr{oetje,eeting}s,

Geert

You don't mean linux-next? And not in virtio-net? I don't see page_address being used on void * anywhere there.

http://kisskb.ellerman.id.au/kisskb/buildresult/10469287/

I'm making {,set}page_address() static inline to fix this.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#4 lore raw
Quoted 14 lines · Geert Uytterhoeven
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Geert Uytterhoeven
Quoted 8 lines · Michael S. Tsirkin

As a result of backporting a bugfix, virtio_net started passing void * to page_address, assuming that it will get silently converted to struct page *. But this does not happen on architectures where page_address is a macro, the result is build failure as the macro tries to dereference void*.

Fix by reordering code slightly, so we always pass struct page * to page_address.

Thanks for the clue! I was just investigating a similar failure in -next.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Gr{oetje,eeting}s,

Geert

You don't mean linux-next? And not in virtio-net? I don't see page_address being used on void * anywhere there.

http://kisskb.ellerman.id.au/kisskb/buildresult/10469287/

Wew, so it's not my fault :)

Quoted 1 line

I'm making {,set}page_address() static inline to fix this.

Yes, I don't see why it has to be a macro.

Quoted 10 lines

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds