[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] 9pfs/proxy: Check return value of proxy_marshal()
From: |
Greg Kurz |
Subject: |
Re: [PATCH] 9pfs/proxy: Check return value of proxy_marshal() |
Date: |
Thu, 21 Jan 2021 18:04:06 +0100 |
On Mon, 11 Jan 2021 10:49:56 +0100
Greg Kurz <groug@kaod.org> wrote:
> 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
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
Applied to https://gitlab.com/gkurz/qemu/-/tree/9p-next
> 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);
>
>