From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PATCH] fixup! virtio: introduce virtio_map
Date: Tue, 27 Oct 2015 23:00:36 +0200 [thread overview]
Message-ID: <1445979626-10103-1-git-send-email-mst@redhat.com> (raw)
Stefan noticed that we must use memmove, not memcpy,
as arguments overlap.
Signed-off-by: Michael S. Tsirkin <mst@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
next reply other threads:[~2015-10-27 21:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 21:00 Michael S. Tsirkin [this message]
2015-10-28 11:40 ` [Qemu-devel] [PATCH] fixup! virtio: introduce virtio_map Stefan Hajnoczi
-- strict thread matches above, loose matches on Subject: below --
2015-10-27 12:30 Michael S. Tsirkin
2015-10-27 12:51 ` Cornelia Huck
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=1445979626-10103-1-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=imammedo@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).