Received: by 10.223.176.5 with SMTP id f5csp2930829wra; Mon, 5 Feb 2018 12:31:14 -0800 (PST) X-Google-Smtp-Source: AH8x225KqDTIwWDB4ud/5gh9hEwELmpwYAUScS9AYx2KlRL/Vb5PXAob2y9APLyJPuewDWTpcjvV X-Received: by 10.98.32.79 with SMTP id g76mr26869pfg.205.1517862674599; Mon, 05 Feb 2018 12:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517862674; cv=none; d=google.com; s=arc-20160816; b=fkMV8lzncFh6kPlTUePgWJraPf4p6BXaCa+X44vsZJ/UeoCFl+edz6429VV7MFLIsE /AIr1bZha/jJ68D1fWZAbNDuM+NqTVo+oe3rGehpREJanBiZvDhbXri7mFyVf4SHaRuY CggUAH0/m40+PQla7XsZdIIfJsk61suxLbkSgOh6Yeeb9pJVPKBZQ4Eov8NNVtsMpiz8 LIcLgTIc73jiM8bRSzNQ3aBbu45a9xGCIIROrzwGM+tUB4mF11jJb9GJoztrCpQzwI3B iwFyNnBKquTt13e6KI84786JoocnxTSBSvMCadiMcdDRmaSS6efJqOSdQm9fvOwtd2RV gsNw== 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=bqk+o68dadHH//Qr3u+cLcXbckuhmfMPxg0G9cR1gVw=; b=cw6NPq4kwPdgY4p0woC3G3iQa9cdP28pokxq6aW8a6l4KMjcMiCy9EiKuHMCfAKxBC e31AcSSjDbCcdbLbV8CcYLRkwOltAI7JoxSZx1KplJPdI4U1Mu8nWpjYsvuA6FGSFHTE A/TCKdNmrKYFsOdVbbNVGoOhiHswNN5wHKZ8kPbZDhtLjwQGCecsvl0lg0izxgrCl253 a7OlZSrDy2OzTeLTjezPsV7CCEph3mqYZqJoGGJETVgibQwzcpn82qBufNXuGA4ykKj7 1eIzomendWdAbS+eschy6pyo5vxe+nKrreQqZ2YrESMMKCQt3j72+omOEdZETk+1Lo0P qffA== 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 u6si4066872pgb.287.2018.02.05.12.30.59; Mon, 05 Feb 2018 12:31:14 -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 S1751907AbeBEUaX (ORCPT + 99 others); Mon, 5 Feb 2018 15:30:23 -0500 Received: from gateway23.websitewelcome.com ([192.185.48.104]:42907 "EHLO gateway23.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751617AbeBEUaK (ORCPT ); Mon, 5 Feb 2018 15:30:10 -0500 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 2554F17ABC for ; Mon, 5 Feb 2018 14:08:06 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id in3eef5iJzzFjin3eeItip; Mon, 05 Feb 2018 14:08:06 -0600 Received: from [189.152.201.65] (port=46616 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1ein3d-003ITZ-M9; Mon, 05 Feb 2018 14:08:05 -0600 Date: Mon, 5 Feb 2018 14:08:04 -0600 From: "Gustavo A. R. Silva" To: Ramesh Shanmugasundaram , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH v2 3/8] i2c: max2175: use 64-bit arithmetic instead of 32-bit Message-ID: 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: 1ein3d-003ITZ-M9 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.152.201.65]:46616 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 21 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 LL to constant 2 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 s64 (64 bits, signed). The expression 2 * (clock_rate - abs_nco_freq) is currently being evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 1446589 Signed-off-by: Gustavo A. R. Silva --- Changes in v2: - Update subject and changelog to better reflect the proposed code changes. - Add suffix LL to constant instead of casting a variable. drivers/media/i2c/max2175.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/max2175.c b/drivers/media/i2c/max2175.c index 2f1966b..87cba15 100644 --- a/drivers/media/i2c/max2175.c +++ b/drivers/media/i2c/max2175.c @@ -643,7 +643,7 @@ static int max2175_set_nco_freq(struct max2175 *ctx, s32 nco_freq) if (abs_nco_freq < clock_rate / 2) { nco_val_desired = 2 * nco_freq; } else { - nco_val_desired = 2 * (clock_rate - abs_nco_freq); + nco_val_desired = 2LL * (clock_rate - abs_nco_freq); if (nco_freq < 0) nco_val_desired = -nco_val_desired; } -- 2.7.4