From nobody Tue Apr 30 07:14:49 2024 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487268329508873.7185595308639; Thu, 16 Feb 2017 10:05:29 -0800 (PST) Received: from localhost ([::1]:48855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceQQm-0008IN-Ay for importer@patchew.org; Thu, 16 Feb 2017 13:05:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cePpV-0003kU-Vp for qemu-devel@nongnu.org; Thu, 16 Feb 2017 12:26:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cePpV-0004Yj-9C for qemu-devel@nongnu.org; Thu, 16 Feb 2017 12:26:54 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:48542) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cePpV-0004Y9-2B; Thu, 16 Feb 2017 12:26:53 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1cePpR-00039v-Co; Thu, 16 Feb 2017 17:26:49 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 16 Feb 2017 17:26:48 +0000 Message-Id: <1487266008-13492-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH] lm32: milkymist-tmu2: fix a third integer overflow 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: qemu-trivial@nongnu.org, Michael Walle , patches@linaro.org 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" Don't truncate the multiplication and do a 64 bit one instead because the result is stored in a 64 bit variable. This fixes a similar coverity warning to commits 237a8650d640 and 4382fa655498, in a similar way, and is the final third of the fix for coverity CID 1167561 (hopefully!). Signed-off-by: Peter Maydell Acked-by: Michael Walle Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- Third time lucky -- I checked and this is the last of these multiply lines. hw/display/milkymist-tmu2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c index 7528665..59120dd 100644 --- a/hw/display/milkymist-tmu2.c +++ b/hw/display/milkymist-tmu2.c @@ -293,7 +293,7 @@ static void tmu2_start(MilkymistTMU2State *s) cpu_physical_memory_unmap(mesh, mesh_len, 0, mesh_len); =20 /* Write back the OpenGL framebuffer to the QEMU framebuffer */ - fb_len =3D 2 * s->regs[R_DSTHRES] * s->regs[R_DSTVRES]; + fb_len =3D 2ULL * s->regs[R_DSTHRES] * s->regs[R_DSTVRES]; fb =3D cpu_physical_memory_map(s->regs[R_DSTFBUF], &fb_len, 1); if (fb =3D=3D NULL) { glDeleteTextures(1, &texture); --=20 2.7.4