[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 44/55] virtio-blk: Correct bug in support for flexibl
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 44/55] virtio-blk: Correct bug in support for flexible descriptor layout |
Date: |
Fri, 15 Aug 2014 18:06:51 +0100 |
From: Marc MarĂ <address@hidden>
Without this correction, only a three descriptor layout is accepted, and
requests with just two descriptors are not completed and no error message is
displayed.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Marc MarĂ <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/block/virtio-blk.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index c241c50..302c39e 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -404,19 +404,19 @@ void virtio_blk_handle_request(VirtIOBlockReq *req,
MultiReqBuffer *mrb)
* NB: per existing s/n string convention the string is
* terminated by '\0' only when shorter than buffer.
*/
- strncpy(req->elem.in_sg[0].iov_base,
- s->blk.serial ? s->blk.serial : "",
- MIN(req->elem.in_sg[0].iov_len, VIRTIO_BLK_ID_BYTES));
+ const char *serial = s->blk.serial ? s->blk.serial : "";
+ size_t size = MIN(strlen(serial) + 1,
+ MIN(iov_size(in_iov, in_num),
+ VIRTIO_BLK_ID_BYTES));
+ iov_from_buf(in_iov, in_num, 0, serial, size);
virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
virtio_blk_free_request(req);
} else if (type & VIRTIO_BLK_T_OUT) {
- qemu_iovec_init_external(&req->qiov, &req->elem.out_sg[1],
- req->elem.out_num - 1);
+ qemu_iovec_init_external(&req->qiov, iov, out_num);
virtio_blk_handle_write(req, mrb);
} else if (type == VIRTIO_BLK_T_IN || type == VIRTIO_BLK_T_BARRIER) {
/* VIRTIO_BLK_T_IN is 0, so we can't just & it. */
- qemu_iovec_init_external(&req->qiov, &req->elem.in_sg[0],
- req->elem.in_num - 1);
+ qemu_iovec_init_external(&req->qiov, in_iov, in_num);
virtio_blk_handle_read(req);
} else {
virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP);
--
1.9.3
- [Qemu-devel] [PULL 37/55] parallels: split check for parallels format in parallels_open, (continued)
- [Qemu-devel] [PULL 37/55] parallels: split check for parallels format in parallels_open, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 34/55] dataplane: stop trying on notifier error, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 38/55] parallels: 2TB+ parallels images support, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 40/55] ide: Fix segfault when flushing a device that doesn't exist, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 39/55] qemu-options: add missing -drive discard option to cmdline help, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 30/55] qemu-char: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK), Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 41/55] libqtest: add QTEST_LOG for debugging qtest testcases, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 42/55] libqos: Correct mask to align size to PAGE_SIZE in malloc-pc, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 45/55] ide: only constrain read/write requests to drive size, not other types, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 43/55] libqos: Change free function called in malloc, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 44/55] virtio-blk: Correct bug in support for flexible descriptor layout,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 46/55] docs: Specification for the image fuzzer, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 47/55] image-fuzzer: Tool for fuzz tests execution, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 48/55] image-fuzzer: Fuzzing functions for qcow2 images, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 50/55] image-fuzzer: Public API for image-fuzzer/runner/runner.py, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 49/55] image-fuzzer: Generator of fuzzed qcow2 images, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 51/55] docs: Expand the list of supported image elements with L1/L2 tables, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 52/55] image-fuzzer: Add fuzzing functions for L1/L2 table entries, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 53/55] image-fuzzer: Add generators of L1/L2 tables, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 55/55] qcow2: fix new_blocks double-free in alloc_refcount_block(), Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 54/55] image-fuzzer: Reduce number of generator functions in __init__, Stefan Hajnoczi, 2014/08/15