Received: by 10.223.176.5 with SMTP id f5csp876978wra; Tue, 6 Feb 2018 08:50:13 -0800 (PST) X-Google-Smtp-Source: AH8x2278zsRei4z9Lz+IsedcKrfpQ3nKk/a6jIFoXNmsebGDDWW2ASdauOAnmk5f97dvkkUUAqmi X-Received: by 10.101.66.6 with SMTP id c6mr2495484pgq.213.1517935813246; Tue, 06 Feb 2018 08:50:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517935813; cv=none; d=google.com; s=arc-20160816; b=oPG4wTuHSfXgm6x8cjkIJO53qbFeCp6Qvi798kMGKiyBIMvWCg5NXYTPqldN5UfOQ7 dUgHwYjfoJfAerbzug0fxJcVsbS3QSfF8lSrVsKVfDeLjWtD5M8dVi2bxQd4npqt60/w u5PARBkjeJ9s/4Mv37EmN/J1/5IBZA0oLXAQ+9KR0ny4RpIU0239G4/jfnY3aDjNSfP1 5GLzVuCSA/5nZoGeh+/Zs8GzI3JteYkP9Km7Fz4oKkBGjgjDiD3/zk8fxREfiLIXD1jL hnZtHaozXNAhmU6Lu16zubeY8RdxhM16JFh4q5+RFpEs273JOrZNQWfFGDNBADOUInWJ ylvQ== 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=JBJcoc36E5jir5BqpNuOnPcxJfVTSLDfH4cFH8UAWj4=; b=HTT2Jrpa6K+pkJ/y9zpLUwqv/EiQzGBQxO2P3Ylr+zvIZ8ix6Xs4G1Zkz5eGikd5OV Y7cETI5CFUkR47CjGT4Wuu+tbmDgEanG1bpECBFs85V9g/uaC6ha4820ZIq1eDdN342x 0e8GCFxwOe9UqVY+LrBNae8K60IJiMfcy29bg2JgaQCa+C/T5JWhR/NSCFZeflOwTHPf lonY5tzYv4PbJ99hNYsEUv6t7QXiMBl8zffD94cYKF/ks7xmOx3RsHNW0q+6I4CcJx/9 w4M2E2PYR+9ndbZKhFsmuksBp+fWiE4+1mKmjjUvp9mcbHBi/ck8WRgEKrACvp8HRm99 QOsg== 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 bj1-v6si2693523plb.286.2018.02.06.08.49.59; Tue, 06 Feb 2018 08:50:13 -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 S1752823AbeBFQtO (ORCPT + 99 others); Tue, 6 Feb 2018 11:49:14 -0500 Received: from gateway32.websitewelcome.com ([192.185.145.113]:36477 "EHLO gateway32.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752259AbeBFQtH (ORCPT ); Tue, 6 Feb 2018 11:49:07 -0500 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway32.websitewelcome.com (Postfix) with ESMTP id B07F1686CD for ; Tue, 6 Feb 2018 10:49:05 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id j6QbetMEQBUMKj6Qbewe8f; Tue, 06 Feb 2018 10:49:05 -0600 Received: from [189.175.4.238] (port=46702 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1ej6Qb-000mjz-AF; Tue, 06 Feb 2018 10:49:05 -0600 Date: Tue, 6 Feb 2018 10:49:04 -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 v3 5/8] pci: cx88-input: use 64-bit arithmetic instead of 32-bit Message-ID: <9db3fe5d4564caf97acb5bee69e92727ada4a633.1517929336.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.175.4.238 X-Source-L: No X-Exim-ID: 1ej6Qb-000mjz-AF X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.175.4.238]:46702 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 31 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 1000000 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 ktime_t (64 bits, signed). The expression ir->polling * 1000000 is currently being evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 1392628 ("Unintentional integer overflow") Addresses-Coverity-ID: 1392630 ("Unintentional integer overflow") 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. Changes in v3: - Mention the specific Coverity reports in the commit message. drivers/media/pci/cx88/cx88-input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c index 4e9953e..6f4e692 100644 --- a/drivers/media/pci/cx88/cx88-input.c +++ b/drivers/media/pci/cx88/cx88-input.c @@ -180,7 +180,7 @@ static enum hrtimer_restart cx88_ir_work(struct hrtimer *timer) struct cx88_IR *ir = container_of(timer, struct cx88_IR, timer); cx88_ir_handle_key(ir); - missed = hrtimer_forward_now(&ir->timer, ir->polling * 1000000); + missed = hrtimer_forward_now(&ir->timer, ir->polling * 1000000LL); if (missed > 1) ir_dprintk("Missed ticks %ld\n", missed - 1); @@ -200,7 +200,7 @@ static int __cx88_ir_start(void *priv) if (ir->polling) { hrtimer_init(&ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ir->timer.function = cx88_ir_work; - hrtimer_start(&ir->timer, ir->polling * 1000000, + hrtimer_start(&ir->timer, ir->polling * 1000000LL, HRTIMER_MODE_REL); } if (ir->sampling) { -- 2.7.4