]> xenbits.xensource.com Git - qemu-xen-4.5-testing.git/commit
hw/9pfs: replace iovec manipulation with QEMUIOVector
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Wed, 21 Dec 2011 07:07:22 +0000 (12:37 +0530)
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Wed, 21 Dec 2011 07:07:22 +0000 (12:37 +0530)
commit302a0d3ed721e4c30c6a2a37f64c60b50ffd33b9
treed8b168af72641484a578bb2b16be4e2c0fb5273f
parent3799ce4ab64f578eb818689a276e4f0c73d01fb5
hw/9pfs: replace iovec manipulation with QEMUIOVector

The v9fs_read() and v9fs_write() functions rely on iovec[] manipulation
code should be replaced with QEMUIOVector to avoid duplicating code.
In the future it may be possible to make the code even more concise by
using QEMUIOVector consistently across virtio and 9pfs.

The "v" format specifier for pdu_marshal() and pdu_unmarshal() is
dropped since it does not actually pack/unpack anything.  The specifier
was also not implemented to update the offset variable and could only be
used at the end of a format string, another sign that this shouldn't
really be a format specifier.  Instead, see the new
v9fs_init_qiov_from_pdu() function.

This change avoids a possible iovec[] buffer overflow when indirect
vrings are used since the number of vectors is now limited by the
underlying VirtQueueElement and cannot be out-of-bounds.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
hw/9pfs/virtio-9p.c