From patchwork Tue Jan 24 09:39:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 92326 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1642222qgi; Tue, 24 Jan 2017 02:22:51 -0800 (PST) X-Received: by 10.237.55.97 with SMTP id i88mr29422612qtb.143.1485253371435; Tue, 24 Jan 2017 02:22:51 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n124si3623319qkc.192.2017.01.24.02.22.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 24 Jan 2017 02:22:51 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:47446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVyFU-0008QR-WF for patch@linaro.org; Tue, 24 Jan 2017 05:22:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVxoU-0001g2-En for qemu-devel@nongnu.org; Tue, 24 Jan 2017 04:54:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVxoQ-0005j1-G8 for qemu-devel@nongnu.org; Tue, 24 Jan 2017 04:54:54 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:53181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVxoQ-0005iU-84; Tue, 24 Jan 2017 04:54:50 -0500 Received: from tsrv.tls.msk.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 0028F42105; Tue, 24 Jan 2017 12:54:47 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.tls.msk.ru (Postfix) with SMTP id A7AAD570; Tue, 24 Jan 2017 12:39:43 +0300 (MSK) Received: (nullmailer pid 12659 invoked by uid 1000); Tue, 24 Jan 2017 09:39:41 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Tue, 24 Jan 2017 12:39:29 +0300 Message-Id: <05a23aeae1dc56b7f26c1a348fd6d31790f6baa6.1485250702.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 25/31] hw/display/framebuffer.c: Avoid overflow for framebuffers > 4GB 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 Tokarev Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Coverity points out that calculating src_len by multiplying src_width by rows could overflow. This can only happen in the implausible case of a framebuffer larger than 4GB, but we may as well fix it, placating Coverity. (CID1005515) Signed-off-by: Peter Maydell Signed-off-by: Michael Tokarev --- hw/display/framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.1.4 diff --git a/hw/display/framebuffer.c b/hw/display/framebuffer.c index df51358..25aa46c 100644 --- a/hw/display/framebuffer.c +++ b/hw/display/framebuffer.c @@ -78,7 +78,7 @@ void framebuffer_update_display( i = *first_row; *first_row = -1; - src_len = src_width * rows; + src_len = (hwaddr)src_width * rows; mem = mem_section->mr; if (!mem) {