From patchwork Wed Oct 12 22:35:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 9373885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6869560772 for ; Wed, 12 Oct 2016 22:36:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 634CE29661 for ; Wed, 12 Oct 2016 22:36:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57B8F29791; Wed, 12 Oct 2016 22:36:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3740429661 for ; Wed, 12 Oct 2016 22:36:22 +0000 (UTC) Received: from localhost ([::1]:36217 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buS8L-0002eI-30 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Oct 2016 18:36:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buS7f-0002cK-65 for qemu-devel@nongnu.org; Wed, 12 Oct 2016 18:35:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buS7d-0002bv-6D for qemu-devel@nongnu.org; Wed, 12 Oct 2016 18:35:38 -0400 Received: from ssl.serverraum.org ([2a01:4f8:130:84d6::1:2]:40434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buS7c-0002bc-Pc for qemu-devel@nongnu.org; Wed, 12 Oct 2016 18:35:36 -0400 Received: from apollo.fritz.box (ip5f585ef2.dynamic.kabel-deutschland.de [95.88.94.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 50BD822278; Thu, 13 Oct 2016 00:35:34 +0200 (CEST) Authentication-Results: ssl.serverraum.org; dmarc=none header.from=walle.cc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1476311734; bh=suyhwkQm5lfLbwyfMuk/v2NbwDyjOP9g1ihsbB3tTDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A9SwLiA/WCvmhJ/Jb8SSw/w0KMvDFjqMAJoprQYeDM4bkT1/GCmy8ICItjG0NqqDQ HgA76khAyXt5jETVrpkZSUPGmqBkbEkVE+O/9d0ueaT7Mx4s5AT08Q+tz3Kkb/w4Wr 0BTIGR8sRiXpegs/LetBeQCnCU3VjQFza8bX/UNg= From: Michael Walle To: qemu-devel@nongnu.org Date: Thu, 13 Oct 2016 00:35:07 +0200 Message-Id: <1476311708-14792-3-git-send-email-michael@walle.cc> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1476311708-14792-1-git-send-email-michael@walle.cc> References: <1476311708-14792-1-git-send-email-michael@walle.cc> X-Virus-Scanned: clamav-milter 0.99.2 at web X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:130:84d6::1:2 Subject: [Qemu-devel] [PATCH 3/4] lm32: milkymist-tmu2: fix 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, Peter Maydell , Michael Walle Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Don't truncate the multiplication and do a 64 bit one instead because because the result is stored in a 64 bit variable. Spotted by coverity, CID 1167561. Signed-off-by: Michael Walle Reviewed-by: Peter Maydell --- 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 9c00184..5c666f9 100644 --- a/hw/display/milkymist-tmu2.c +++ b/hw/display/milkymist-tmu2.c @@ -213,7 +213,7 @@ static void tmu2_start(MilkymistTMU2State *s) /* Read the QEMU source framebuffer into an OpenGL texture */ glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); - fb_len = 2*s->regs[R_TEXHRES]*s->regs[R_TEXVRES]; + fb_len = 2ULL * s->regs[R_TEXHRES] * s->regs[R_TEXVRES]; fb = cpu_physical_memory_map(s->regs[R_TEXFBUF], &fb_len, 0); if (fb == NULL) { glDeleteTextures(1, &texture);