summaryrefslogtreecommitdiff
path: root/sys/dev/usb/udcf.c
diff options
context:
space:
mode:
authorMarc Balmer <mbalmer@cvs.openbsd.org>2006-11-15 07:10:15 +0000
committerMarc Balmer <mbalmer@cvs.openbsd.org>2006-11-15 07:10:15 +0000
commit6b4f71635879a1b4d279383a12bccb3e55bbd926 (patch)
treec8125b6780a1697f25bd2000af60874eb7c099e4 /sys/dev/usb/udcf.c
parentae77e2e2ad4a32ab6603e77a1d3d03b921a1549d (diff)
Fix an integer type promotion that can lead to wrong offsets on 64 bit arches.
Problem and solution found by Christian "Naddy" Weisgerber <naddy@openbsd.org>, thanks!
Diffstat (limited to 'sys/dev/usb/udcf.c')
-rw-r--r--sys/dev/usb/udcf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/usb/udcf.c b/sys/dev/usb/udcf.c
index fea027dd3f0..6c1431d64fc 100644
--- a/sys/dev/usb/udcf.c
+++ b/sys/dev/usb/udcf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udcf.c,v 1.20 2006/10/28 09:26:46 mbalmer Exp $ */
+/* $OpenBSD: udcf.c,v 1.21 2006/11/15 07:10:14 mbalmer Exp $ */
/*
* Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org>
@@ -403,8 +403,8 @@ udcf_probe(void *xsc)
microtime(&sc->sc_sensor.tv);
nanotime(&now);
sc->sc_current = sc->sc_next;
- sc->sc_sensor.value = (now.tv_sec - sc->sc_current)
- * 1000000000 + now.tv_nsec;
+ sc->sc_sensor.value = (int64_t)(now.tv_sec -
+ sc->sc_current) * 1000000000LL + now.tv_nsec;
/* set the clocktype and make sensor valid */
if (sc->sc_sensor.status == SENSOR_S_UNKNOWN) {