Received: by 10.223.176.5 with SMTP id f5csp2911796wra; Mon, 5 Feb 2018 12:07:35 -0800 (PST) X-Google-Smtp-Source: AH8x227OHyRbhwCNedRlLRU4ocsCE3RuGPz8d7wrqmaNd80m/d3Qokb3dTAI+esAcBwDdGJJY4eN X-Received: by 10.98.254.21 with SMTP id z21mr28652pfh.48.1517861255242; Mon, 05 Feb 2018 12:07:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517861255; cv=none; d=google.com; s=arc-20160816; b=Ce6tgZMauZ9lqvhJoVcBYFBfn1SMBgmdoZ2wqiW30Bg/ORrtNXsSMH7GAFNccpnBWW akQ+F+jp6bQIt8yIuk0MraP8nuXBUT+7Lxlt9QK3x+FlcJxZsVI6srbwqRu4JjVVKN5P tMDOJ9A1+aCh5nIDM3/uyCEEovn5J/ExU1+VP6kkSz+7mnex8Cplih+tPVDAneEMQp+U zTv+dw68hAdEjzXKXCM/o2ndKEvcWu7YhJ6DjEF3g8U1rlJsUueOKRxZ9JYs+W6mbCOD 1JkpEMnJfqYTeQg4LiNn2mqwCCWfUiytDNreW0ELhjJFj/HO9ZpMU1pzQeGv2Yccr/IN LIqQ== 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=bPyZT7Eu4HAKYW9NxnKedQXoBk9rCzF+4EZ4h3829KM=; b=0NxWpIEBHkinzOy/THjRr5pHyjyVUavTuL+5jzfN9QdsAgVdajKlBRU3uNCPWcPgZ6 6F0BebTLt2Aq3K4tNXD0Nwfz/i6buPYl8TSHVuWrYvk3bLcSJowrtT1Rc/ObErm/+6X3 AhHqRLUkwjkyigTIx/lDXbgb1NWtFolwZzucWM2djdt4Ma3l6HwUIdcxJGBd7Sf+vf2f ho9vzAo4J7F+DL6Jx6Rj2ldWl60pXqGh0YM0nd/XTEo5h82rvSP7gqtDzaMBYjVZ1Z/N 4Tc8ugvPd/L9hCDP7XLMDwcxSEAa2JFdcjpmqEJ+uAUA+ACES15UIcfwL2lXgoOom/kk EXVQ== 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 p28si5111305pfi.139.2018.02.05.12.07.21; Mon, 05 Feb 2018 12:07:35 -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 S1751836AbeBEUGp (ORCPT + 99 others); Mon, 5 Feb 2018 15:06:45 -0500 Received: from gateway22.websitewelcome.com ([192.185.47.129]:11791 "EHLO gateway22.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751589AbeBEUGk (ORCPT ); Mon, 5 Feb 2018 15:06:40 -0500 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 64711181F3 for ; Mon, 5 Feb 2018 14:06:39 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id in2FeJ9ErcGlpin2FeJmTp; Mon, 05 Feb 2018 14:06:39 -0600 Received: from [189.152.201.65] (port=46564 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1ein2E-003HFO-Ub; Mon, 05 Feb 2018 14:06:39 -0600 Date: Mon, 5 Feb 2018 14:06:37 -0600 From: "Gustavo A. R. Silva" To: Antti Palosaari , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH v2 1/8] rtl2832: use 64-bit arithmetic instead of 32-bit in rtl2832_set_frontend Message-ID: <381d67326e15bfbb588947d13def3f6a1571db85.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: 1ein2E-003HFO-Ub X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.152.201.65]:46564 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 14 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 7 in order to give the compiler complete information about the proper arithmetic to use. Notice that this constant is used in a context that expects an expression of type u64 (64 bits, unsigned). The expression dev->pdata->clk * 7 is currently being evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 1271223 Signed-off-by: Gustavo A. R. Silva --- Changes in v2: - Update subject and changelog to better reflect the proposed code changes. - Add suffix ULL to constant instead of casting a variable. drivers/media/dvb-frontends/rtl2832.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index 94bf5b7..fa3b816 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c @@ -498,7 +498,7 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe) * RSAMP_RATIO = floor(CrystalFreqHz * 7 * pow(2, 22) * / ConstWithBandwidthMode) */ - num = dev->pdata->clk * 7; + num = dev->pdata->clk * 7ULL; num *= 0x400000; num = div_u64(num, bw_mode); resamp_ratio = num & 0x3ffffff; @@ -511,7 +511,7 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe) * / (CrystalFreqHz * 7)) */ num = bw_mode << 20; - num2 = dev->pdata->clk * 7; + num2 = dev->pdata->clk * 7ULL; num = div_u64(num, num2); num = -num; cfreq_off_ratio = num & 0xfffff; -- 2.7.4