diff options
author | Dongli Zhang <dongli.zhang@oracle.com> | 2018-11-02 14:16:36 +0800 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2018-12-11 18:28:46 +0100 |
commit | e4fbf5b2454e23d3b7050b54702cd451117252d8 (patch) | |
tree | 09cf129aa97d55f82e15a33497bfc18eb2478b68 /hw | |
parent | 27c6ef1b5857b1447f0a0f8da4bd7df3e1a7a637 (diff) | |
download | qemu-e4fbf5b2454e23d3b7050b54702cd451117252d8.zip qemu-e4fbf5b2454e23d3b7050b54702cd451117252d8.tar.gz qemu-e4fbf5b2454e23d3b7050b54702cd451117252d8.tar.bz2 |
virtio: pass argument by value for virtqueue_map_iovec()
Pass num_sg by value instead of by pointer, as num_sg is never modified in
virtqueue_map_iovec().
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1541139396-4727-1-git-send-email-dongli.zhang@oracle.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/virtio/virtio.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 5828ed1..22bd1ac 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -796,13 +796,13 @@ static void virtqueue_undo_map_desc(unsigned int out_num, unsigned int in_num, } static void virtqueue_map_iovec(VirtIODevice *vdev, struct iovec *sg, - hwaddr *addr, unsigned int *num_sg, + hwaddr *addr, unsigned int num_sg, int is_write) { unsigned int i; hwaddr len; - for (i = 0; i < *num_sg; i++) { + for (i = 0; i < num_sg; i++) { len = sg[i].iov_len; sg[i].iov_base = dma_memory_map(vdev->dma_as, addr[i], &len, is_write ? @@ -821,8 +821,8 @@ static void virtqueue_map_iovec(VirtIODevice *vdev, struct iovec *sg, void virtqueue_map(VirtIODevice *vdev, VirtQueueElement *elem) { - virtqueue_map_iovec(vdev, elem->in_sg, elem->in_addr, &elem->in_num, 1); - virtqueue_map_iovec(vdev, elem->out_sg, elem->out_addr, &elem->out_num, 0); + virtqueue_map_iovec(vdev, elem->in_sg, elem->in_addr, elem->in_num, 1); + virtqueue_map_iovec(vdev, elem->out_sg, elem->out_addr, elem->out_num, 0); } static void *virtqueue_alloc_element(size_t sz, unsigned out_num, unsigned in_num) |