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>
This commit is contained in:
parent
27c6ef1b58
commit
e4fbf5b245
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue