From nobody Mon Feb 9 23:11:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1610358751; cv=none; d=zohomail.com; s=zohoarc; b=ANyTLEq8DgcN4cISJfnUFw/Yvt+2ZEh7XrxhT3bs91bxdGcAG+i5p5Hw0xTP8FEjJ2+jIVFEN8PpB8/rfzqCA07GPjpoKseVUYEVeF117e/VG/GC5IwRTdTx1X/z6G3SPflZleJ8U10gXdpGpTp8nVHymClS7GbneN1zhrHsF20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610358751; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=eu+EasphmEEHzoS+bHiXRmZcyn2PNBNj3W8p+dLCVU4=; b=VRnTpW4Rmrrj9KIyOIikzW+F9EOUrFU76lrSoq09jTSxHCt5CuaBT1JE5E4XeYC+p8OoZ622b6AzoHWD0Wsb86aRFQSIwylt2GJ/GWtXEbFBymaXC8s86qT0/dpMVHWQjnS82lAk1ivFocoBk3mRDPgom0Rm3anwQ73f/6u8YvA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16103587512041.6727095184182872; Mon, 11 Jan 2021 01:52:31 -0800 (PST) Received: from localhost ([::1]:54882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kytsD-0000BQ-OP for importer@patchew.org; Mon, 11 Jan 2021 04:52:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kytq2-0007Mz-12 for qemu-devel@nongnu.org; Mon, 11 Jan 2021 04:50:15 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:49368) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kytq0-0001JX-JA for qemu-devel@nongnu.org; Mon, 11 Jan 2021 04:50:13 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-lA0nEegEM9qPOKCrCgEUAw-1; Mon, 11 Jan 2021 04:49:59 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D631107AFC8; Mon, 11 Jan 2021 09:49:58 +0000 (UTC) Received: from bahia.lan (ovpn-113-142.ams2.redhat.com [10.36.113.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9168F5D9F4; Mon, 11 Jan 2021 09:49:57 +0000 (UTC) X-MC-Unique: lA0nEegEM9qPOKCrCgEUAw-1 Subject: [PATCH] 9pfs/proxy: Check return value of proxy_marshal() From: Greg Kurz To: qemu-devel@nongnu.org Date: Mon, 11 Jan 2021 10:49:56 +0100 Message-ID: <161035859647.1221144.4691749806675653934.stgit@bahia.lan> User-Agent: StGit/0.21 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=groug@kaod.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: softfail client-ip=205.139.111.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Christian Schoenebeck , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Christian Schoenebeck --- 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, voi= d *response, ...) } =20 /* marshal the header details */ - proxy_marshal(iovec, 0, "dd", header.type, header.size); + retval =3D proxy_marshal(iovec, 0, "dd", header.type, header.size); + assert(retval =3D=3D 4 * 2); header.size +=3D PROXY_HDR_SZ; =20 retval =3D qemu_write_full(proxy->sockfd, iovec->iov_base, header.size= );