Skip to contentSkip to conversation

qemu:virtio-net: Check return size on the correct sg list

PATCH Applied Alex Williamson 2 participants 2 messages Mar 11, 2009 – Mar 13, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu:virtio-net: Check return size on the correct sg list

When checking that the size of the control virtqueue return field is sufficient, use the correct sg list.

---

 hw/virtio-net.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/virtio-net.c +1 -1
index e83d101..ad55bb7 100644
@@ -228,7 +228,7 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
         }
 
         if (elem.out_sg[0].iov_len < sizeof(ctrl) ||
-            elem.out_sg[elem.in_num - 1].iov_len < sizeof(status)) {
+            elem.in_sg[elem.in_num - 1].iov_len < sizeof(status)) {
             fprintf(stderr, "virtio-net ctrl header not in correct element\n");
             exit(1);
         }
#1 lore raw
Quoted 5 lines · Alex Williamson

When checking that the size of the control virtqueue return field is sufficient, use the correct sg list.

Applied to stable and trunk. Thanks.

Regards,

Anthony Liguori

Quoted 23 lines

---

 hw/virtio-net.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/virtio-net.c +1 -1
index e83d101..ad55bb7 100644
@@ -228,7 +228,7 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
         }
 
         if (elem.out_sg[0].iov_len < sizeof(ctrl) ||
-            elem.out_sg[elem.in_num - 1].iov_len < sizeof(status)) {
+            elem.in_sg[elem.in_num - 1].iov_len < sizeof(status)) {
             fprintf(stderr, "virtio-net ctrl header not in correct element\n");
             exit(1);
         }