Skip to content

Commit

Permalink
clockevents: warn once when program_event() is called with negative e…
Browse files Browse the repository at this point in the history
…xpiry

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 <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Dec 7, 2007
1 parent 62f0f61 commit 167b1de
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/time/clockevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 167b1de

Please sign in to comment.