Received: by 10.223.185.116 with SMTP id b49csp3923248wrg; Tue, 13 Feb 2018 09:48:56 -0800 (PST) X-Google-Smtp-Source: AH8x224nQlTL9UDO9sf4KIz/rKZhPWRvSV5g0BXd4KEAaykYDIX/FkwE9oIHqsT5qBSIZkoV+raD X-Received: by 2002:a17:902:9306:: with SMTP id bc6-v6mr1807386plb.29.1518544136421; Tue, 13 Feb 2018 09:48:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518544136; cv=none; d=google.com; s=arc-20160816; b=cT2LfqmbMvRVzKg9SqZnGfvycL8cx9i2Qj2peplTapEMonRMAodKXbHJJW92RZIJk+ iap5yOyhrLgOBVy3aogUs0dtQjeAYQvIkvsz8PFi1N5D3E/irRB0ZOfxpsrhgqoKoDA5 AYKfd1HLBpl1gRytUQoPG6/yptWKCWyMp3twUUl1679//rTkaosLhfV2btw2LDqvGBIo RkfzUaQ2zKKFD73xbzfNc83/giqAdpAla0AXokEK05o7xiZVQciXH3l2YCCedUZt6pkR jhcOurJGbzZsZOfCjGgqrRMYCZZ55b4JlpST/uejfO1ZzW+GG6WinAJwnNq/fgJ5tuMz zGVg== 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 :arc-authentication-results; bh=53DcTHTRucNn+zwZcHEK++TQu2nh/Px4gYSuqWCXGpQ=; b=xP/WZqwnry7ml1nuovjjGq9z4WLSLsN3p39J7DyvVl41aC4IwUTtARPT5SsqG1GkX9 /940MbSVi1dIywtRw0FJbxMhnWBh6WxsZOGO9PoSUaJ9QTJeky9UBxlrH5bKkxKehO+9 8Ol6PCRaViN543KBUpgaPjSWf64UxM2CKKRkzCX2Nigm2xp5m1Nx+/SCTodDTAns85Bp y8dA6wrLd8E0MSVYYneBJeMkxjthuZzV0jrLKAz3sN96WmLhrCeFPQg5iuPrgDwQ4IqA CyVWxhLhl19y2XmRJppe2SKf15/yDha5kk/gj5jIr7KzqMUe+cyTAZKy6nCzuRWJl0cv d6iw== 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 y82si1193045pfj.27.2018.02.13.09.48.41; Tue, 13 Feb 2018 09:48:56 -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 S965298AbeBMRsC (ORCPT + 99 others); Tue, 13 Feb 2018 12:48:02 -0500 Received: from gateway30.websitewelcome.com ([192.185.192.34]:47496 "EHLO gateway30.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965057AbeBMRsB (ORCPT ); Tue, 13 Feb 2018 12:48:01 -0500 X-Greylist: delayed 1691 seconds by postgrey-1.27 at vger.kernel.org; Tue, 13 Feb 2018 12:48:01 EST Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 74BFE16212 for ; Tue, 13 Feb 2018 10:53:03 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id ldpHeejlLODN4ldpHeXnHi; Tue, 13 Feb 2018 10:53:03 -0600 Received: from [189.175.4.238] (port=35058 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1eldpG-001CH2-So; Tue, 13 Feb 2018 10:53:02 -0600 Date: Tue, 13 Feb 2018 10:52:58 -0600 From: "Gustavo A. R. Silva" To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] iio: adc: ina2xx: Use 64-bit arithmetic instead of 32-bit Message-ID: <20180213165258.GA12967@embeddedor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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.175.4.238 X-Source-L: No X-Exim-ID: 1eldpG-001CH2-So X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.175.4.238]:35058 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 12 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 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 1000 * sampling_us is currently being evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 1463793 Signed-off-by: Gustavo A. R. Silva --- drivers/iio/adc/ina2xx-adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c index 0635a79..8649700 100644 --- a/drivers/iio/adc/ina2xx-adc.c +++ b/drivers/iio/adc/ina2xx-adc.c @@ -810,7 +810,7 @@ static int ina2xx_capture_thread(void *data) * multiple times, i.e. samples are dropped. */ do { - timespec64_add_ns(&next, 1000 * sampling_us); + timespec64_add_ns(&next, 1000ULL * sampling_us); delta = timespec64_sub(next, now); delay_us = div_s64(timespec64_to_ns(&delta), 1000); } while (delay_us <= 0); -- 2.7.4