On Sun, May 16, 2010 at 2:25 PM, Christoph Hellwig <h...@lst.de> wrote: > On Fri, May 14, 2010 at 10:52:30PM +0100, Stefan Hajnoczi wrote: >> diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c >> index b05d15e..d270225 100644 >> --- a/hw/virtio-blk.c >> +++ b/hw/virtio-blk.c >> @@ -105,8 +105,10 @@ static void virtio_blk_flush_complete(void *opaque, int >> ret) >> >> static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s) >> { >> - VirtIOBlockReq *req = qemu_mallocz(sizeof(*req)); >> + VirtIOBlockReq *req = qemu_malloc(sizeof(*req)); >> req->dev = s; >> + req->qiov.size = 0; >> + req->next = NULL; >> return req; > > Looks good, but you shouldn't even need to initialize req->qiov.size, we > do this later by calling qemu_iovec_init_external before using it.
virtio_blk_req_complete() uses req->qiov.size and may be called by virtio_blk_handle_flush() or virtio_blk_handle_scsi() without being initialized. It's a little ugly that we use the qiov like that. Stefan