fixup! virtio: introduce virtio_map
PATCH 1/1 fixup! virtio: introduce virtio_map
Stefan noticed that we must use memmove, not memcpy, as arguments overlap.
Signed-off-by Michael S. Tsirkin <[email protected]>
--- hw/virtio/virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/virtio.c +2 -2
@@ -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
Quoted 7 lines · Michael S. Tsirkin
Stefan noticed that we must use memmove, not memcpy, as arguments overlap.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/virtio/virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by Stefan Hajnoczi <[email protected]>