From patchwork Tue Oct 12 06:01:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 4587 Return-path: Envelope-to: mchehab@pedra Delivery-date: Tue, 12 Oct 2010 11:20:07 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1P5fi2-0000zB-Td for mchehab@pedra; Tue, 12 Oct 2010 11:20:07 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Tue, 12 Oct 2010 11:20:06 -0300 (BRT) Received: from bombadil.infradead.org ([2001:4830:2446:ff00:4687:fcff:fea6:5117]) by casper.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1P5Xw4-0007n2-PL for mchehab@casper.infradead.org; Tue, 12 Oct 2010 06:02:05 +0000 Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1P5Xw2-0002Qc-Vv; Tue, 12 Oct 2010 06:02:03 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753126Ab0JLGB7 (ORCPT + 1 other); Tue, 12 Oct 2010 02:01:59 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:64369 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753320Ab0JLGB7 (ORCPT ); Tue, 12 Oct 2010 02:01:59 -0400 Received: by wwj40 with SMTP id 40so4607785wwj.1 for ; Mon, 11 Oct 2010 23:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=YRHvCM/4RdPYACpwP/jKNUaavUhmp+2JfPWG/g8LH50=; b=iNXyAw6qWY6W4t5z0bf3rVXIcsem+6HMRJAph9HMQrpmohrMlBxspO7gEIOItMscsq JVNktWJ85I5X2bybco6m2ZynByPv9mwUdf5yNtYd8a5Z2xbaPjZe9M7E51/dykYGEzeW fr8GcFxMmwQ2Y6Q4ozuNn99tRM/sy9dL2pA/s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=KOch3Meo/QONZC4wCbVeu6aJMcggTC/bJQgwDOsFx7QoQd0i1Xj0IITQJ8nau+7fbA 4XcvxkCblkFr/fVWNz2OESI/uG/6T91iTFVxue4d6z5Caew7F9beb4+RHDTx0F8AH/dN KIcU5A6llfJojCAztY1+7+aP61YqXNMYbK90Q= Received: by 10.216.157.81 with SMTP id n59mr6211097wek.84.1286863317358; Mon, 11 Oct 2010 23:01:57 -0700 (PDT) Received: from bicker (h3f06.n1.ips.mtn.co.ug [41.210.191.6]) by mx.google.com with ESMTPS id k4sm45585weq.9.2010.10.11.23.01.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 11 Oct 2010 23:01:56 -0700 (PDT) Date: Tue, 12 Oct 2010 08:01:11 +0200 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Jarod Wilson , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch -next] V4L/DVB: IR/streamzap: fix usec to nsec conversion Message-ID: <20101012060110.GA13176@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: There is an integer overflow here because 0x03000000 * 1000 is too large for 31 bits. rawir.duration should be in terms of nsecs. IR_MAX_DURATION and 0x03000000 are already in terms of nsecs. STREAMZAP_TIMEOUT and STREAMZAP_RESOLUTION are 255 and 256 respectively and are in terms of usecs. The original code had a deadline of 1.005 seconds and the new code has a deadline of .065 seconds. Signed-off-by: Dan Carpenter Acked-by: Jarod Wilson --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/IR/streamzap.c b/drivers/media/IR/streamzap.c index 2cf57e6..d5d3cee 100644 --- a/drivers/media/IR/streamzap.c +++ b/drivers/media/IR/streamzap.c @@ -221,7 +221,7 @@ static void streamzap_callback(struct urb *urb) struct streamzap_ir *sz; unsigned int i; int len; - static int timeout = (((STREAMZAP_TIMEOUT * STREAMZAP_RESOLUTION) & + static int timeout = (((STREAMZAP_TIMEOUT * STREAMZAP_RESOLUTION * 1000) & IR_MAX_DURATION) | 0x03000000); if (!urb) @@ -273,7 +273,7 @@ static void streamzap_callback(struct urb *urb) struct ir_raw_event rawir; rawir.pulse = false; - rawir.duration = timeout * 1000; + rawir.duration = timeout; sz->idle = true; if (sz->timeout_enabled) sz_push(sz, rawir);