Message ID | 94fd0993cde02e18ee5d7f54707f8ce0d0341a0c.1517929336.git.gustavo@embeddedor.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org> 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 1E59D605BA for <patchwork-linux-rockchip@patchwork.kernel.org>; Tue, 6 Feb 2018 16:52:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBDD928DAA for <patchwork-linux-rockchip@patchwork.kernel.org>; Tue, 6 Feb 2018 16:52:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA63F28D4C; Tue, 6 Feb 2018 16:52:09 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 81CD128CCC for <patchwork-linux-rockchip@patchwork.kernel.org>; Tue, 6 Feb 2018 16:51:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hNsxdW3p9l8llEe2NoDmUtgd+aiAqC+812U3FKnZQwY=; b=b6a0VpgyjAmqcg rgfwA6aJ5PZM7NDuErmB/JBgtsfp7pD/o5+Y/QAi+0nSoMLepzKYx7BAw2ni81r+4E+pUCxrTTush nfWbB/VA0r4rKFBoKBm7wVo7xI9EFSGJjNhkIoZtoWYBuoedXyPTI5RG3DY9RcrnDjG0PXZkog97g jAub8887NzMiXCOeM1hVgmj7NDCeV4/Sc/ZGtn0PqM+Np2e6dBgO3TfADe3JfETr/Ff+PdNt1Pum3 Dhft6qX28gHtiOHfYpBBZH6BKN5DR6IfgjyahheqraV7E2N3DJBH96II5ApYS1KpuMbZq4zfL8XjJ oH2gLzxhhLkbGisC+Wow==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ej6T0-0003gH-7v; Tue, 06 Feb 2018 16:51:34 +0000 Received: from gateway24.websitewelcome.com ([192.185.50.66]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ej6Sx-0003dl-2U for linux-rockchip@lists.infradead.org; Tue, 06 Feb 2018 16:51:32 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway24.websitewelcome.com (Postfix) with ESMTP id EDFED63970F for <linux-rockchip@lists.infradead.org>; Tue, 6 Feb 2018 10:51:19 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id j6Sle7vvQODN4j6Sle2CNA; Tue, 06 Feb 2018 10:51:19 -0600 Received: from [189.175.4.238] (port=46798 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from <gustavo@embeddedor.com>) id 1ej6Sl-000pK8-9Q; Tue, 06 Feb 2018 10:51:19 -0600 Date: Tue, 6 Feb 2018 10:51:18 -0600 From: "Gustavo A. R. Silva" <gustavo@embeddedor.com> To: Jacob chen <jacob2.chen@rock-chips.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Heiko Stuebner <heiko@sntech.de> Subject: [PATCH v3 6/8] rockchip/rga: use 64-bit arithmetic instead of 32-bit Message-ID: <94fd0993cde02e18ee5d7f54707f8ce0d0341a0c.1517929336.git.gustavo@embeddedor.com> References: <cover.1517929336.git.gustavo@embeddedor.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <cover.1517929336.git.gustavo@embeddedor.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.175.4.238 X-Source-L: No X-Exim-ID: 1ej6Sl-000pK8-9Q X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.175.4.238]:46798 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 38 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms <linux-rockchip.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-rockchip>, <mailto:linux-rockchip-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-rockchip/> List-Post: <mailto:linux-rockchip@lists.infradead.org> List-Help: <mailto:linux-rockchip-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-rockchip>, <mailto:linux-rockchip-request@lists.infradead.org?subject=subscribe> Cc: linux-rockchip@lists.infradead.org, "Gustavo A. R. Silva" <garsilva@embeddedor.com>, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" <linux-rockchip-bounces@lists.infradead.org> Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/media/platform/rockchip/rga/rga-buf.c b/drivers/media/platform/rockchip/rga/rga-buf.c index 49cacc7..a43b57a 100644 --- a/drivers/media/platform/rockchip/rga/rga-buf.c +++ b/drivers/media/platform/rockchip/rga/rga-buf.c @@ -140,7 +140,8 @@ void rga_buf_map(struct vb2_buffer *vb) address = sg_phys(sgl); for (p = 0; p < len; p++) { - dma_addr_t phys = address + (p << PAGE_SHIFT); + dma_addr_t phys = address + + ((dma_addr_t)p << PAGE_SHIFT); pages[mapped_size + p] = phys; }
Cast p to dma_addr_t in order to avoid a potential integer overflow. This variable is being used in a context that expects an expression of type dma_addr_t (u64). The expression p << PAGE_SHIFT is currently being evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 1458347 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> --- Changes in v2: - Update subject and changelog to better reflect the proposed code change. Changes in v3: - Mention the specific Coverity report in the commit message. drivers/media/platform/rockchip/rga/rga-buf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)