aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/IR
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-10-12 09:42:08 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-20 23:18:38 -0400
commitb784cfcec7293f688b09d3850826216a4e134d2e (patch)
treea71f990d9a36073a2175adb39aa1235f1f10665c /drivers/media/IR
parentb768d47eb6e467b198351c0344e2e3e49c45c476 (diff)
[media] IR/streamzap: fix usec to nsec conversion
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 <error27@gmail.com> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR')
-rw-r--r--drivers/media/IR/streamzap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/IR/streamzap.c b/drivers/media/IR/streamzap.c
index 623ee2dc198e..86a4f68feea4 100644
--- a/drivers/media/IR/streamzap.c
+++ b/drivers/media/IR/streamzap.c
@@ -221,7 +221,7 @@ static void streamzap_callback(struct urb *urb)
221 struct streamzap_ir *sz; 221 struct streamzap_ir *sz;
222 unsigned int i; 222 unsigned int i;
223 int len; 223 int len;
224 static int timeout = (((SZ_TIMEOUT * SZ_RESOLUTION) & 224 static int timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) &
225 IR_MAX_DURATION) | 0x03000000); 225 IR_MAX_DURATION) | 0x03000000);
226 226
227 if (!urb) 227 if (!urb)
@@ -273,7 +273,7 @@ static void streamzap_callback(struct urb *urb)
273 struct ir_raw_event rawir; 273 struct ir_raw_event rawir;
274 274
275 rawir.pulse = false; 275 rawir.pulse = false;
276 rawir.duration = timeout * 1000; 276 rawir.duration = timeout;
277 sz->idle = true; 277 sz->idle = true;
278 if (sz->timeout_enabled) 278 if (sz->timeout_enabled)
279 sz_push(sz, rawir); 279 sz_push(sz, rawir);