qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-trivial@nongnu.org, Laurent Vivier <laurent@vivier.eu>,
	Richard Henderson <rth@twiddle.net>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Michael Tokarev <mjt@tls.msk.ru>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Dongli Zhang <dongli.zhang@oracle.com>
Subject: [Qemu-devel] [PULL 02/30] virtio: pass argument by value for virtqueue_map_iovec()
Date: Tue, 11 Dec 2018 19:03:24 +0100	[thread overview]
Message-ID: <20181211180352.19644-3-laurent@vivier.eu> (raw)
In-Reply-To: <20181211180352.19644-1-laurent@vivier.eu>

From: Dongli Zhang <dongli.zhang@oracle.com>

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>
---
 hw/virtio/virtio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 5828ed14df..22bd1ac34e 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)
-- 
2.19.2

  parent reply	other threads:[~2018-12-11 18:04 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 18:03 [Qemu-devel] [PULL 00/30] Trivial patches Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 01/30] hw: qdev: fix error in comment Laurent Vivier
2018-12-11 18:03 ` Laurent Vivier [this message]
2018-12-11 18:03 ` [Qemu-devel] [PULL 03/30] misc: fix spelling Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 04/30] hw: set_netdev: remove useless code Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 05/30] qapi: Reduce Makefile boilerplate Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 06/30] misc: Avoid UTF-8 in error messages Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 07/30] MAINTAINERS: Add missing hw/pci-host entries Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 08/30] MAINTAINERS: Add nios2-related files to the Nios2 section Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 09/30] target: hax: replace g_malloc with g_new0 Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 10/30] MAINTAINERS: Fix ACPI tests data files path Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 11/30] MAINTAINERS: Add a missing entry to the SPARC CPU Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 12/30] MAINTAINERS: Add missing entries for the Xilinx ZynqMP machine Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 13/30] MAINTAINERS: Add missing entries for the Jazz machine Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 14/30] MAINTAINERS: Add a missing entry for the Xilinx S3A-DSP 1800 machine Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 15/30] MAINTAINERS: Add a missing entry for the Old World machines Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 16/30] MAINTAINERS: Add a missing entry for the sun4m machines Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 17/30] MAINTAINERS: Add missing entries to the PC Chipset section Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 18/30] MAINTAINERS: Add missing entries to the vhost section Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 19/30] MAINTAINERS: Add missing entries for the Canon DIGIC machine Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 20/30] MAINTAINERS: Add missing entries for the MPS2 machine Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 21/30] MAINTAINERS: Add a missing entry to SPICE Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 22/30] MAINTAINERS: Add a missing entry to the QMP section Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 23/30] MAINTAINERS: Add a missing entry for the NVDIMM device Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 24/30] MAINTAINERS: Use my work email to review Build and test automation patches Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 25/30] target: hax: fix errors in comment Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 26/30] util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci() Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 27/30] cutils: Assert in-range base for string-to-integer conversions Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 28/30] MAINTAINERS: Update email address for Fam Zheng Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 29/30] maint: Grammar fix to mailmap Laurent Vivier
2018-12-11 18:03 ` [Qemu-devel] [PULL 30/30] Fixes i386 xchgq test Laurent Vivier
2018-12-12 21:11 ` [Qemu-devel] [PULL 00/30] Trivial patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181211180352.19644-3-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=dongli.zhang@oracle.com \
    --cc=ehabkost@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).