From: Aneesh Kumar K.V Date: Tue, 5 Feb 2013 05:57:45 +0000 (+0530) Subject: qemu/iovec: Don't assert if sbytes is zero X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=facf98ad987a38d97e12511f81375380b407a828;p=qmiga%2Fqemu.git qemu/iovec: Don't assert if sbytes is zero Since these values can possibly be sent from guest (for hw/9pfs), do a sanity check on them. A 9p write request with 0 bytes caused qemu to abort without this patch Signed-off-by: Aneesh Kumar K.V Signed-off-by: Anthony Liguori --- diff --git a/util/iov.c b/util/iov.c index c0f5c56618..fbe675d373 100644 --- a/util/iov.c +++ b/util/iov.c @@ -304,6 +304,10 @@ void qemu_iovec_concat_iov(QEMUIOVector *dst, { int i; size_t done; + + if (!sbytes) { + return; + } assert(dst->nalloc != -1); for (i = 0, done = 0; done < sbytes && i < src_cnt; i++) { if (soffset < src_iov[i].iov_len) {