From patchwork Tue Feb 5 05:57:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] qemu/iovec: Don't assert if sbytes is zero Date: Mon, 04 Feb 2013 19:57:45 -0000 From: Aneesh Kumar K.V X-Patchwork-Id: 218159 Message-Id: <1360043866-17721-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, "Aneesh Kumar K.V" From: "Aneesh Kumar K.V" 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 --- util/iov.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/iov.c b/util/iov.c index c0f5c56..fbe675d 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) {