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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
--

Index: linux-2.6.19-rc5-mm1.orig/include/linux/ktime.h
===================================================================
--- linux-2.6.19-rc5-mm1.orig.orig/include/linux/ktime.h	2006-11-09 12:49:34.000000000 +0100
+++ linux-2.6.19-rc5-mm1.orig/include/linux/ktime.h	2006-11-10 19:22:35.000000000 +0100
@@ -248,9 +248,9 @@ static inline struct timeval ktime_to_ti
  *
  * 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

--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux