提交 167b1de3 编写于 作者: T Thomas Gleixner 提交者: Ingo Molnar

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: NThomas Gleixner <tglx@linutronix.de>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 62f0f61e
...@@ -78,6 +78,11 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, ...@@ -78,6 +78,11 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires,
unsigned long long clc; unsigned long long clc;
int64_t delta; int64_t delta;
if (unlikely(expires.tv64 < 0)) {
WARN_ON_ONCE(1);
return -ETIME;
}
delta = ktime_to_ns(ktime_sub(expires, now)); delta = ktime_to_ns(ktime_sub(expires, now));
if (delta <= 0) if (delta <= 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册