Skip to contentSkip to conversation

fixup! virtio: introduce virtio_map

PATCH In review Michael S. Tsirkin 2 participants 2 messages Oct 27, 2015 – Oct 28, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fixup! virtio: introduce virtio_map

Stefan noticed that we must use memmove, not memcpy, as arguments overlap.

---
 hw/virtio/virtio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/virtio.c +2 -2
index ed1f274..939f802 100644
@@ -481,8 +481,8 @@ static void virtqueue_map_iovec(struct iovec *sg, hwaddr *addr,
             error_report("virtio: memory split makes iovec too large");
             exit(1);
         }
-        memcpy(sg + i + 1, sg + i, sizeof(*sg) * (*num_sg - i));
-        memcpy(addr + i + 1, addr + i, sizeof(*addr) * (*num_sg - i));
+        memmove(sg + i + 1, sg + i, sizeof(*sg) * (*num_sg - i));
+        memmove(addr + i + 1, addr + i, sizeof(*addr) * (*num_sg - i));
         assert(len < sg[i + 1].iov_len);
         sg[i].iov_len = len;
         addr[i + 1] += len;
Signature · 1 line
MST