summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormbalmer <mbalmer@openbsd.org>2006-11-15 07:10:14 +0000
committermbalmer <mbalmer@openbsd.org>2006-11-15 07:10:14 +0000
commit2d1e8da4999cfcf3301f78dd8793558cce70a5d3 (patch)
treeb7683bb5d677d47880152a32641aa138289d9394
parentreject multicast packet without scope identifier specified. (diff)
downloadwireguard-openbsd-2d1e8da4999cfcf3301f78dd8793558cce70a5d3.tar.xz
wireguard-openbsd-2d1e8da4999cfcf3301f78dd8793558cce70a5d3.zip
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!
-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) {