aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2013-10-17 21:23:26 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-10-18 13:02:57 +0200
commitb432779a9fe9c2a1bb8cbd98feb341af6e32f892 (patch)
tree071b78f5f27c2a52da5ed879de0c3886066a31cd
parent45d57f6e718e44e55780bcf1d09fa140dce7ec08 (diff)
virtio: Remove unneeded memcpy
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>
-rw-r--r--hw/block/virtio-blk.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 49a23c33f7..13f6d8276e 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;