From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Stefan Weil <sw@weilnetz.de>,
Stefan Hajnoczi <stefanha@redhat.com>,
Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PULL 5/7] virtio: Remove unneeded memcpy
Date: Fri, 18 Oct 2013 16:18:33 +0200 [thread overview]
Message-ID: <1382105915-27735-6-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1382105915-27735-1-git-send-email-stefanha@redhat.com>
From: Stefan Weil <sw@weilnetz.de>
Report from valgrind:
==19521== Source and destination overlap in memcpy(0x31d38938, 0x31d38938, 64)
==19521== at 0x4A0A343: memcpy@@GLIBC_2.14 (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==19521== by 0x42774E: virtio_blk_device_init (virtio-blk.c:686)
==19521== by 0x46EE9E: virtio_device_init (virtio.c:1158)
==19521== by 0x25405E: device_realize (qdev.c:178)
==19521== by 0x2559B5: device_set_realized (qdev.c:699)
==19521== by 0x3A819B: property_set_bool (object.c:1315)
==19521== by 0x3A6CE0: object_property_set (object.c:803)
Valgrind is right: blk == &s->blks, so it is a memcpy of 64 byte with
source == destination which can be removed.
Reported-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/block/virtio-blk.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 49a23c3..13f6d82 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -703,7 +703,6 @@ static int virtio_blk_device_init(VirtIODevice *vdev)
s->bs = blk->conf.bs;
s->conf = &blk->conf;
- memcpy(&(s->blk), blk, sizeof(struct VirtIOBlkConf));
s->rq = NULL;
s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1;
--
1.8.3.1
next prev parent reply other threads:[~2013-10-18 14:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-18 14:18 [Qemu-devel] [PULL 0/7] Block patches Stefan Hajnoczi
2013-10-18 14:18 ` [Qemu-devel] [PULL 1/7] hmp: drop bogus "[not inserted]" Stefan Hajnoczi
2013-10-18 14:18 ` [Qemu-devel] [PULL 2/7] sd: Avoid access to NULL BlockDriverState Stefan Hajnoczi
2013-10-18 14:18 ` [Qemu-devel] [PULL 3/7] blockdev: fix cdrom read_only flag Stefan Hajnoczi
2013-10-18 14:18 ` [Qemu-devel] [PULL 4/7] block/raw-win32: Always use -errno in hdev_open Stefan Hajnoczi
2013-10-18 14:18 ` Stefan Hajnoczi [this message]
2013-10-18 14:18 ` [Qemu-devel] [PULL 6/7] vmdk: Only read cid from image file when opening Stefan Hajnoczi
2013-10-18 14:18 ` [Qemu-devel] [PULL 7/7] vmdk: fix VMFS extent parsing Stefan Hajnoczi
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=1382105915-27735-6-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=aliguori@amazon.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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).