Received: by 10.223.176.5 with SMTP id f5csp2930202wra; Mon, 5 Feb 2018 12:30:38 -0800 (PST) X-Google-Smtp-Source: AH8x224WgGviNjSjCZ4yX6u23hUjb70KfcbTi47fCjEspy+uU1HSeHbrbiEooV8+DBKtFKcEhfs/ X-Received: by 10.99.96.144 with SMTP id u138mr49460pgb.114.1517862637995; Mon, 05 Feb 2018 12:30:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517862637; cv=none; d=google.com; s=arc-20160816; b=r7bnAuC21frq/7q2CRSI1qsNxo+EZqnA+rEntW1uLjpXTWnZAkEZLzoj0Z6NwmzWIi sjbiapAUU/LCepEWFgtwwMo+D5yaQEEpBCzaMiQdgrhZFlgyJNA5Y5693tNUqs0HGvwS rNZ+/nZulQzOKm64ho3LPfI6r2JHpz3BvomlstbbQ8chk/HOEVfxdXNfROnGl+mpu4ao ELhAe/69//o6mTZEIcMl+1IBZ7tqeT+h2OQ2r93afRU+Hs8s8e2heVRbUCuNGR2AthVv I9nqFN0bYJ8e+RP5mhhjPS3evHz1uPDiEiq5YXUTefs/PKkXdRhqT4gxXUO+LH5nET83 uXlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=8jCQ8vXpo7MXB8qPr/8Zc/Rv0977FP5B0EPxeT+6PQY=; b=mWT63AZS7hJPIlG9rpotHqlqtEzGTySgyANpmDLpm8u8umsM0bsQ6CI3xFw5HqkTjW C49D2/1t/qxHn+c3TzW6CXK2dp28sIw+j9WB2ItDfdRX6bVlys9eXYUMi6d3kwn8SpoV uoY1jKqYvXjqe9u1AdBmQ4XSjJzWJXjbpYWMNJvYlHztk3e5b7RoUieMZf7mjzZunR9v tvkyTc/a/Vyr5IBKFtiAU12wC9XEcek/1zSCwfrPg/8T1ox+XcB0rEM01/OqV5L0x5au QkfP2plI4Dkm1hS+kG+fgPB4qt73EDL+kRaPTA/xOQaODQTir9nvVCdmAbqAXENvg3T1 8AIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2-v6si1143662pli.824.2018.02.05.12.30.23; Mon, 05 Feb 2018 12:30:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752054AbeBEU2H (ORCPT + 99 others); Mon, 5 Feb 2018 15:28:07 -0500 Received: from gateway23.websitewelcome.com ([192.185.48.104]:35797 "EHLO gateway23.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752022AbeBEU15 (ORCPT ); Mon, 5 Feb 2018 15:27:57 -0500 X-Greylist: delayed 1191 seconds by postgrey-1.27 at vger.kernel.org; Mon, 05 Feb 2018 15:27:57 EST Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 32CE710144 for ; Mon, 5 Feb 2018 14:27:57 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id inMreaCalBUMKinMreddUj; Mon, 05 Feb 2018 14:27:57 -0600 Received: from [189.152.201.65] (port=47710 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1einMq-003ZXY-Qh; Mon, 05 Feb 2018 14:27:56 -0600 Date: Mon, 5 Feb 2018 14:27:56 -0600 From: "Gustavo A. R. Silva" To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH v2 7/8] platform: sh_veu: use 64-bit arithmetic instead of 32-bit Message-ID: <502e55a2fd44a61126b639d581c8fa7447eb0e72.1517856716.git.gustavo@embeddedor.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 - vger.kernel.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.152.201.65 X-Source-L: No X-Exim-ID: 1einMq-003ZXY-Qh X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.152.201.65]:47710 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 37 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Cast left and top to dma_addr_t in order to give the compiler complete information about the proper arithmetic to use. Notice that these variables are being used in contexts that expect expressions of type dma_addr_t (64 bit, unsigned). Such expressions are currently being evaluated using 32-bit arithmetic. Also, move the expression (((dma_addr_t)left * veu->vfmt_out.fmt->depth) >> 3) at the end in order to avoid a line wrapping checkpatch.pl warning. Addresses-Coverity-ID: 1056807 Addresses-Coverity-ID: 1056808 Signed-off-by: Gustavo A. R. Silva --- Changes in v2: - Update subject and changelog to better reflect the proposed code changes. - Move the expression (((dma_addr_t)left * veu->vfmt_out.fmt->depth) >> 3) at the end in order to avoid a line wrapping checkpatch.pl warning. drivers/media/platform/sh_veu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c index 976ea0b..1a0cde0 100644 --- a/drivers/media/platform/sh_veu.c +++ b/drivers/media/platform/sh_veu.c @@ -520,8 +520,8 @@ static void sh_veu_colour_offset(struct sh_veu_dev *veu, struct sh_veu_vfmt *vfm /* dst_left and dst_top validity will be verified in CROP / COMPOSE */ unsigned int left = vfmt->frame.left & ~0x03; unsigned int top = vfmt->frame.top; - dma_addr_t offset = ((left * veu->vfmt_out.fmt->depth) >> 3) + - top * veu->vfmt_out.bytesperline; + dma_addr_t offset = (dma_addr_t)top * veu->vfmt_out.bytesperline + + (((dma_addr_t)left * veu->vfmt_out.fmt->depth) >> 3); unsigned int y_line; vfmt->offset_y = offset; -- 2.7.4