Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3166449ybl; Sun, 11 Aug 2019 17:08:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6WPUzX3Y2sciXYTohpnfClmSNQVsDKAbe/TFzeBH35d/KXXAZRaENGnXdRqBO9uJZCf9E X-Received: by 2002:aa7:968d:: with SMTP id f13mr7646311pfk.223.1565568538574; Sun, 11 Aug 2019 17:08:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565568538; cv=none; d=google.com; s=arc-20160816; b=CZMOoiUrmdYWDKJVFVFF5t55hLEihBW3iBOoZ3vVJoUcVbSxhkZhwI0VRr20nDczBL OCyQo4pyVopE+v+ddd/zsJ5u5KB4puz21t/oOMw+RWvp5teuF/dkdDCX/Uxj1XVBhzJT YjQ0oo+jm/KNI9ifZt0uZygTL/nZWGzm+PCthTOFn1esJJjgv3OZ5Qon5XBb6QMMuknh L7PqzSTZVcNgxxn9co8FbdnLn0Zai8QsRfJe5vqXz5+ebtH1AaS3LR1PAcMPzwP1bZeO DV6KtckEw5Owv5oFFDdcHR3e5ykfiVH8p6Gu3LtZOAeCzlGKethX2zZILtrf5K5jGJDE LoXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=HkwYskj4hcqhar/pMnuy1yYlf+y7tZmG56Gg3PFUL0k=; b=eFie+989MM3l2BmXnnHJJqw4Axlejp2HbJ4KCk5CSG/XOEfpEQ8OsmWmfgnn5aPceX IwChTfFowFA1q+wvy29TJnuz8EuvUTw9cD9mzZVO7rcHWBEXPi9P6JNV7BlS7IWubR2P wYZHTxYGb/7sHCRGS2hjPfEFvSyRkUT5C3WaJZTK3L5NtCYfg6HgzRvDP9mwxEQMoA2+ t4HeRppSOacWl7vxD0xZE0e0Sn/w1wBKrIRuM+dXC5Whgu/tCeC79rO4GC4NlttEBhT5 DC2xLwxRGVYF8HCuaCqbi8sY62PoeChIn6djhZFFQaXbJAYneib/wK13utXqD2QZ5vfF cIPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=JPVkijIL; 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 u27si61829501pgn.231.2019.08.11.17.08.41; Sun, 11 Aug 2019 17:08:58 -0700 (PDT) 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; dkim=fail header.i=@embeddedor.com header.s=default header.b=JPVkijIL; 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 S1726594AbfHLAIH (ORCPT + 99 others); Sun, 11 Aug 2019 20:08:07 -0400 Received: from gateway21.websitewelcome.com ([192.185.45.43]:12255 "EHLO gateway21.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725870AbfHLAIG (ORCPT ); Sun, 11 Aug 2019 20:08:06 -0400 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 7F55A400C95E7 for ; Sun, 11 Aug 2019 19:08:05 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id wxsbhWUWV3Qi0wxsbhEoB4; Sun, 11 Aug 2019 19:08:05 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=embeddedor.com; s=default; h=Content-Type:MIME-Version:Message-ID:Subject: Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=HkwYskj4hcqhar/pMnuy1yYlf+y7tZmG56Gg3PFUL0k=; b=JPVkijILtRkj9igWsLFjuJmYKS F6CinifQtxXBv7RW3u4IN8In493M+5I2neJuiW7XfzXSqrDNg/Zr02XVfXlm/PwP29tt5KP4mMRie HPxbIABPA0ukRCfyr9UdHNomWKpYkYicF+0dCsZn/gkzvCeVt2j8HbbCg9w8D6iQjRj8Ew6RXazHW yAe8khiwLlq2fxLIVW8syIYNZSwcvOmeg+Xz+gOBqamAUuK0+UFrI/hDSZ9FPcnnYz6qMTqkgssXX 6rKg1UaFiclhTCHAEO6rh5z+ZOPDg96QQQiWcAB9Eaa/iyoXblSQaa+nx5lWPw9qm3CCbjjESAFIS KM8pQ5uQ==; Received: from [187.192.11.120] (port=52004 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.92) (envelope-from ) id 1hwxsa-002WKs-7p; Sun, 11 Aug 2019 19:08:04 -0500 Date: Sun, 11 Aug 2019 19:08:01 -0500 From: "Gustavo A. R. Silva" To: "James (Qian) Wang" , Liviu Dudau , Brian Starkey , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] drm/komeda: Fix potential integer overflow in komeda_crtc_update_clock_ratio Message-ID: <20190812000801.GA29204@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) 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: 187.192.11.120 X-Source-L: No X-Exim-ID: 1hwxsa-002WKs-7p X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [187.192.11.120]:52004 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 7 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 Add suffix ULL to constant 1000 in order to avoid a potential integer overflow and give the compiler complete information about the proper arithmetic to use. Notice that this constant is being used in a context that expects an expression of type u64, but it's currently evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 1485796 ("Unintentional integer overflow") Fixes: ed22c6d9304d ("drm/komeda: Use drm_display_mode "crtc_" prefixed hardware timings") Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/arm/display/komeda/komeda_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index fa9a4593bb37..624d257da20f 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -27,7 +27,7 @@ static void komeda_crtc_update_clock_ratio(struct komeda_crtc_state *kcrtc_st) return; } - pxlclk = kcrtc_st->base.adjusted_mode.crtc_clock * 1000; + pxlclk = kcrtc_st->base.adjusted_mode.crtc_clock * 1000ULL; aclk = komeda_crtc_get_aclk(kcrtc_st); kcrtc_st->clock_ratio = div64_u64(aclk << 32, pxlclk); -- 2.22.0