Stefan noticed that we must use memmove, not memcpy, as arguments overlap. Signed-off-by: Michael S. Tsirkin <m...@redhat.com> --- hw/virtio/virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index ed1f274..939f802 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -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; -- MST