提交 cfd18934 编写于 作者: T Thomas Gleixner 提交者: Linus Torvalds

[PATCH] ktime: Fix signed / unsigned mismatch in ktime_to_ns

The 32 bit implementation of ktime_to_ns returns unsigned value, while the
64 bit version correctly returns an signed value.  There is no current user
affected by this, but it has to be fixed, as ktime values can be negative.
Pointed-out-by: NHelmut Duregger <Helmut.Duregger@student.uibk.ac.at>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Acked-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 b46be050
......@@ -248,9 +248,9 @@ static inline struct timeval ktime_to_timeval(const ktime_t kt)
*
* Returns the scalar nanoseconds representation of kt
*/
static inline u64 ktime_to_ns(const ktime_t kt)
static inline s64 ktime_to_ns(const ktime_t kt)
{
return (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
}
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册