Skip to content

Commit

Permalink
[PATCH] ktime: Fix signed / unsigned mismatch in ktime_to_ns
Browse files Browse the repository at this point in the history
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: Helmut Duregger <Helmut.Duregger@student.uibk.ac.at>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Thomas Gleixner authored and Linus Torvalds committed Dec 7, 2006
1 parent b46be05 commit cfd1893
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/ktime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cfd1893

Please sign in to comment.