aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-09-24 13:26:55 +0200
committerMichael S. Tsirkin <mst@redhat.com>2012-10-29 18:25:23 +0200
commitc8d28e7e336869524d166d88f08ad476eadedccb (patch)
treea1ed89c685f95ac09c13f53c3ba461a0580dacd9 /hw
parent280598b7a5fdf96fb79d87a2129750bad5dbf24b (diff)
downloadqemu-c8d28e7e336869524d166d88f08ad476eadedccb.zip
qemu-c8d28e7e336869524d166d88f08ad476eadedccb.tar.gz
qemu-c8d28e7e336869524d166d88f08ad476eadedccb.tar.bz2
virtio-net: first s/g is always at start of buf
We know offset is 0, assert that. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio-net.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 5128a2a..59ab674 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -631,6 +631,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t
}
if (i == 0) {
+ assert(offset == 0);
if (n->mergeable_rx_bufs) {
mhdr_cnt = iov_copy(mhdr_sg, ARRAY_SIZE(mhdr_sg),
sg, elem.in_num,
@@ -638,8 +639,8 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t
sizeof(mhdr.num_buffers));
}
- receive_header(n, sg, elem.in_num, buf + offset, size - offset);
- offset += n->host_hdr_len;
+ receive_header(n, sg, elem.in_num, buf, size);
+ offset = n->host_hdr_len;
total += n->guest_hdr_len;
guest_offset = n->guest_hdr_len;
} else {