From: Greg Kurz <groug@kaod.org>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Christian Schoenebeck <qemu_oss@crudebyte.com>,
Greg Kurz <groug@kaod.org>
Subject: [PULL 1/5] 9pfs/proxy: Check return value of proxy_marshal()
Date: Mon, 25 Jan 2021 12:44:39 +0100 [thread overview]
Message-ID: <20210125114443.933857-2-groug@kaod.org> (raw)
In-Reply-To: <20210125114443.933857-1-groug@kaod.org>
This should always successfully write exactly two 32-bit integers.
Make it clear with an assert(), like v9fs_receive_status() and
v9fs_receive_response() already do when unmarshalling the same
header.
Fixes: Coverity CID 1438968
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Message-Id: <161035859647.1221144.4691749806675653934.stgit@bahia.lan>
Signed-off-by: Greg Kurz <groug@kaod.org>
---
hw/9pfs/9p-proxy.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c
index 6f598a0f111c..4aa4e0a3baa0 100644
--- a/hw/9pfs/9p-proxy.c
+++ b/hw/9pfs/9p-proxy.c
@@ -537,7 +537,8 @@ static int v9fs_request(V9fsProxy *proxy, int type, void *response, ...)
}
/* marshal the header details */
- proxy_marshal(iovec, 0, "dd", header.type, header.size);
+ retval = proxy_marshal(iovec, 0, "dd", header.type, header.size);
+ assert(retval == 4 * 2);
header.size += PROXY_HDR_SZ;
retval = qemu_write_full(proxy->sockfd, iovec->iov_base, header.size);
--
2.26.2
next prev parent reply other threads:[~2021-01-25 11:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-25 11:44 [PULL 0/5] 9p next patches Greg Kurz
2021-01-25 11:44 ` Greg Kurz [this message]
2021-01-25 11:44 ` [PULL 2/5] 9pfs: Convert V9fsFidState::clunked to bool Greg Kurz
2021-01-25 11:44 ` [PULL 3/5] 9pfs: Convert V9fsFidState::fid_list to QSIMPLEQ Greg Kurz
2021-01-25 11:44 ` [PULL 4/5] 9pfs: Improve unreclaim loop Greg Kurz
2021-01-25 11:44 ` [PULL 5/5] 9pfs: Convert reclaim list to QSLIST Greg Kurz
2021-01-25 15:56 ` [PULL 0/5] 9p next patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210125114443.933857-2-groug@kaod.org \
--to=groug@kaod.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu_oss@crudebyte.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).