* [Qemu-devel] [PATCH] virtio: Remove unneeded memcpy
@ 2013-10-17 19:23 Stefan Weil
2013-10-17 20:09 ` Peter Maydell
2013-10-18 11:03 ` Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2013-10-17 19:23 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Stefan Weil, Anthony Liguori, Stefan Hajnoczi
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>
---
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.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio: Remove unneeded memcpy
2013-10-17 19:23 [Qemu-devel] [PATCH] virtio: Remove unneeded memcpy Stefan Weil
@ 2013-10-17 20:09 ` Peter Maydell
2013-10-18 11:03 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2013-10-17 20:09 UTC (permalink / raw)
To: Stefan Weil; +Cc: QEMU Trivial, Stefan Hajnoczi, qemu-devel, Anthony Liguori
On 17 October 2013 20:23, Stefan Weil <sw@weilnetz.de> wrote:
> 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>
I did a quick eyeball of the other memcpy()s in hw/*/*virtio*
and I think this is the only one with this problem.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio: Remove unneeded memcpy
2013-10-17 19:23 [Qemu-devel] [PATCH] virtio: Remove unneeded memcpy Stefan Weil
2013-10-17 20:09 ` Peter Maydell
@ 2013-10-18 11:03 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2013-10-18 11:03 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-trivial, Stefan Hajnoczi, qemu-devel, Anthony Liguori
On Thu, Oct 17, 2013 at 09:23:26PM +0200, Stefan Weil wrote:
> 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>
> ---
> hw/block/virtio-blk.c | 1 -
> 1 file changed, 1 deletion(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-18 11:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-17 19:23 [Qemu-devel] [PATCH] virtio: Remove unneeded memcpy Stefan Weil
2013-10-17 20:09 ` Peter Maydell
2013-10-18 11:03 ` Stefan Hajnoczi
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).