Skip to contentSkip to conversation

virtio-net: fix offload ctrl endian

PATCH In review Jason Wang 2 participants 3 messages Jul 14, 2017 – Jul 17, 2017

lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 virtio-net: fix offload ctrl endian

Spec said offloads should be le64, so use virtio_ldq_p() to guarantee valid endian.

Fixes 644c98587d4c ("virtio-net: dynamic network offloads configuration")
Cc Dmitry Fleytman <[email protected]>
---
 hw/net/virtio-net.c | 1 +
 1 file changed, 1 insertion(+)
hw/net/virtio-net.c +1 -0
index 657d099..eb8f5b6 100644
@@ -757,6 +757,7 @@ static int virtio_net_handle_offloads(VirtIONet *n, uint8_t cmd,
 
     if (cmd == VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET) {
         uint64_t supported_offloads;
+        offloads = virtio_ldq_p(vdev, &offloads);
 
         if (!n->has_vnet_hdr) {
             return VIRTIO_NET_ERR;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 16 lines · Jason Wang

Spec said offloads should be le64, so use virtio_ldq_p() to guarantee valid endian.

Fixes 644c98587d4c ("virtio-net: dynamic network offloads configuration")
Cc Dmitry Fleytman <[email protected]>
---
 hw/net/virtio-net.c | 1 +
 1 file changed, 1 insertion(+)
hw/net/virtio-net.c +0 -0
index 657d099..eb8f5b6 100644

hw/net/virtio-net.c static int virtio_net_handle_offloads(VirtIONet *n, uint8_t cmd, · line 759

Quoted 3 lines
hw/net/virtio-net.c +0 -0
@@ -757,6 +757,7 @@ static int virtio_net_handle_offloads(VirtIONet *n, uint8_t cmd,
 
     if (cmd == VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET) {
         uint64_t supported_offloads;

An empty line wouldn't hurt here.

Quoted 6 lines
hw/net/virtio-net.c +1 -0
+        offloads = virtio_ldq_p(vdev, &offloads);
 
         if (!n->has_vnet_hdr) {
             return VIRTIO_NET_ERR;
Signature · 1 line
2.7.4
author
#2 lore raw
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Jason Wang

Spec said offloads should be le64, so use virtio_ldq_p() to guarantee valid endian.

Fixes 644c98587d4c ("virtio-net: dynamic network offloads configuration")
Cc Dmitry Fleytman <[email protected]>
---
  hw/net/virtio-net.c | 1 +
  1 file changed, 1 insertion(+)
hw/net/virtio-net.c +0 -0
index 657d099..eb8f5b6 100644
@@ -757,6 +757,7 @@ static int virtio_net_handle_offloads(VirtIONet *n, uint8_t cmd,
 
Quoted 3 lines

hw/net/virtio-net.c static int virtio_net_handle_offloads(VirtIONet *n, uint8_t cmd, · line 759

Quoted 2 lines
hw/net/virtio-net.c +0 -0
      if (cmd == VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET) {
          uint64_t supported_offloads;

An empty line wouldn't hurt here.

I apply this patch by adding a new line here.

Thanks

Quoted 7 lines
Quoted 7 lines
hw/net/virtio-net.c +1 -0
+        offloads = virtio_ldq_p(vdev, &offloads);
 
          if (!n->has_vnet_hdr) {
              return VIRTIO_NET_ERR;
Signature · 1 line
2.7.4