Skip to content

Commit

Permalink
9pfs/proxy: Check return value of proxy_marshal()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Greg Kurz <[email protected]>
  • Loading branch information
gkurz committed Jan 21, 2021
1 parent fef80ea commit acef3f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hw/9pfs/9p-proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit acef3f8

Please sign in to comment.