From nobody Tue Feb 10 11:15:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527236443136641.4897851474707; Fri, 25 May 2018 01:20:43 -0700 (PDT) Received: from localhost ([::1]:42380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fM7xh-0002zv-Qf for importer@patchew.org; Fri, 25 May 2018 04:20:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fM7vc-0001kB-ND for qemu-devel@nongnu.org; Fri, 25 May 2018 04:18:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fM7vY-0008FW-DJ for qemu-devel@nongnu.org; Fri, 25 May 2018 04:18:24 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:32979) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fM7vY-0008Er-3V for qemu-devel@nongnu.org; Fri, 25 May 2018 04:18:20 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.183]) with ESMTPSA (Nemesis) id 0M2MnE-1gBc182MhI-00s9UX; Fri, 25 May 2018 10:18:10 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 25 May 2018 10:17:45 +0200 Message-Id: <20180525081754.29506-5-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180525081754.29506-1-la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= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.75 Subject: [Qemu-devel] [PULL 04/13] linux-user: Fix payload size logic in host_to_target_cmsg() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell Coverity points out that there's a missing break in the switch in host_to_target_cmsg() where we update tgt_len for cmsg_level/cmsg_type combinations which require a different length for host and target (CID 1385425). To avoid duplicating the default case (target length same as host) in both switches, set that before the switch so that only the cases which want to override it need any code. This fixes a bug where we would have used the wrong length for SOL_SOCKET/SO_TIMESTAMP messages where the target and host have differently sized 'struct timeval' (ie one is 32 bit and the other is 64 bit). Signed-off-by: Peter Maydell Reviewed-by: Laurent Vivier Message-Id: <20180518184715.29833-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index dd77f86ea2..d02c16bbc6 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1848,6 +1848,7 @@ static inline abi_long host_to_target_cmsg(struct tar= get_msghdr *target_msgh, /* Payload types which need a different size of payload on * the target must adjust tgt_len here. */ + tgt_len =3D len; switch (cmsg->cmsg_level) { case SOL_SOCKET: switch (cmsg->cmsg_type) { @@ -1857,8 +1858,8 @@ static inline abi_long host_to_target_cmsg(struct tar= get_msghdr *target_msgh, default: break; } + break; default: - tgt_len =3D len; break; } =20 --=20 2.14.3