summaryrefslogtreecommitdiffstats
path: root/common/clock.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-04-20 05:39:12 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2010-04-22 13:29:22 +0200
commit3a1617d96f8b4e093917bf05fca4d1e0bd6983e0 (patch)
treeb05f57c5262fa268923733d90b0024a69ada3069 /common/clock.c
parent94e69bc97fe9a3a436069cca97717dbf273252f2 (diff)
downloadbarebox-3a1617d96f8b4e093917bf05fca4d1e0bd6983e0.tar.gz
clock: fix possible error on overflow in is_timeout
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/clock.c')
-rw-r--r--common/clock.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/common/clock.c b/common/clock.c
index 8eeb917..15df0ab 100644
--- a/common/clock.c
+++ b/common/clock.c
@@ -84,8 +84,7 @@ uint32_t clocksource_hz2mult(uint32_t hz, uint32_t shift_constant)
int is_timeout(uint64_t start_ns, uint64_t time_offset_ns)
{
-
- if (start_ns + time_offset_ns < get_time_ns())
+ if ((int64_t)(start_ns + time_offset_ns - get_time_ns()) < 0)
return 1;
else
return 0;