Received: by 10.223.176.5 with SMTP id f5csp3649122wra; Mon, 29 Jan 2018 16:57:08 -0800 (PST) X-Google-Smtp-Source: AH8x227RgBk409/nXGyYQL/hfDJuLalTueOpXu7ZaJq3Q9DYqZhcr06cwwTBnFpdZhlGK3HsP1/7 X-Received: by 10.98.206.1 with SMTP id y1mr28129350pfg.136.1517273828717; Mon, 29 Jan 2018 16:57:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517273828; cv=none; d=google.com; s=arc-20160816; b=FpIFZ6NaxhnzTjuHHibDYGmB9dU60brof4crwbGecTASzHZiyAMi/MzkoNZFMKLz4C DsKWCH4634ElJlFOTd0VRLpKSkXBRuwDRjC6P+cu1JZVsSZFysJaej/jtsWIGu+O4JbK nfBgEqUI5ldT+MWrVnB1lHqvLUSZGaVw4OqoWK+Zg9pYs0CDe0WGnGWmGodd+efJ23wg 9X7mICLnxSPbp+NA2yofBg0cyp9CeM0nCfdc+6C3mVeuNksYCLkirDPUqayyBedFBVPq pmPqjVs81G0m+N4F6FjfFATy5xmbgnkzFvucByq1Rq5T4DZUtvNEIQLLctpIlhCsB2SZ Pciw== 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=+/EXbh+DfwjFlxc3cpDqD5b+hqKF6ZRWjpCxS/NvarE=; b=Wqnv442MGUtB+XY1EUyCJ43EwxFNygvOVQYIgkSTcUKAyt5eFATtVnc4RP8HrnJD5Y J6UoaoHdsNuIKGXUrfazbzJ/M19sCfzXJI62qU0Hl4iryQ3zb2rHM93LwcN+U9oQQ0IN XORaCofWoV4PD9BwA8UOc3/lV7+c1P+O7o0bSJREcpC5OalzP7ALciF5gTc3z9QTPGJc PfZdKOmZZDenRKtfPxJzKDRyJ7GCCuvbyiWlw93czBDxne2MHBWscCFWHi4mcTjECYw3 3F3hRNnOxaU4q9Nle5MsGzM2n5KFXInNIb/CoHYrcimLvGMZ3O/K3Zn6bcVaOReyRkND xfgw== 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 n15si409268pfh.258.2018.01.29.16.56.54; Mon, 29 Jan 2018 16:57:08 -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 S1752329AbeA3A4C (ORCPT + 99 others); Mon, 29 Jan 2018 19:56:02 -0500 Received: from gateway21.websitewelcome.com ([192.185.46.109]:32573 "EHLO gateway21.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752251AbeA3A4B (ORCPT ); Mon, 29 Jan 2018 19:56:01 -0500 X-Greylist: delayed 1479 seconds by postgrey-1.27 at vger.kernel.org; Mon, 29 Jan 2018 19:56:01 EST Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway21.websitewelcome.com (Postfix) with ESMTP id ADED5400CFAF2 for ; Mon, 29 Jan 2018 18:32:22 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id gJqYeO1LdODN4gJqYeJbOf; Mon, 29 Jan 2018 18:32:22 -0600 Received: from [189.145.57.174] (port=35460 helo=training) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1egJqY-001eaY-AI; Mon, 29 Jan 2018 18:32:22 -0600 Date: Mon, 29 Jan 2018 18:32:21 -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 5/8] pci: cx88-input: fix potential integer overflow Message-ID: <7958c3115b5727c2272ce9cf7454cea8e6f4cc50.1517268668.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.145.57.174 X-Source-L: No X-Exim-ID: 1egJqY-001eaY-AI X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (training) [189.145.57.174]:35460 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 27 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 Cast ir->polling to ktime_t in order to avoid a potential integer overflow. This variable is being used in a context that expects an expression of type ktime_t (s64). Addresses-Coverity-ID: 1392628 ("Unintentional integer overflow") Addresses-Coverity-ID: 1392630 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva --- 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..096b350 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, (ktime_t)ir->polling * 1000000); 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, (ktime_t)ir->polling * 1000000, HRTIMER_MODE_REL); } if (ir->sampling) { -- 2.7.4