From 167b1de3ee4e50d65a2bd0a2667c9cd48faf54f3 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 7 Dec 2007 19:16:17 +0100 Subject: clockevents: warn once when program_event() is called with negative expiry The hrtimer problem with large relative timeouts resulting in a negative expiry time went unnoticed as there is no check in the clockevents_program_event() code. Put a check there with a WARN_ONCE to avoid such problems in the future. Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar --- kernel/time/clockevents.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'kernel/time/clockevents.c') diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 822beebe664a..5fb139fef9fa 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -78,6 +78,11 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, unsigned long long clc; int64_t delta; + if (unlikely(expires.tv64 < 0)) { + WARN_ON_ONCE(1); + return -ETIME; + } + delta = ktime_to_ns(ktime_sub(expires, now)); if (delta <= 0) -- cgit v1.2.3