* [patch] ktime: Fix signed / unsigned mismatch in ktime_to_ns
@ 2006-11-10 18:32 Thomas Gleixner
2006-11-10 18:35 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Gleixner @ 2006-11-10 18:32 UTC (permalink / raw)
To: Andrew Morton
Cc: John Stultz, Roman Zippel, Ingo Molnar, LKML, Helmut Duregger
[-- Attachment #1: ktime-fix-signed-unsigned-mismatch.patch --]
[-- Type: text/plain, Size: 1008 bytes --]
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>
--
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
--
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [patch] ktime: Fix signed / unsigned mismatch in ktime_to_ns
2006-11-10 18:32 [patch] ktime: Fix signed / unsigned mismatch in ktime_to_ns Thomas Gleixner
@ 2006-11-10 18:35 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2006-11-10 18:35 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Andrew Morton, John Stultz, Roman Zippel, LKML, Helmut Duregger
* Thomas Gleixner <tglx@linutronix.de> wrote:
> 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>
Ingo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-10 18:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-10 18:32 [patch] ktime: Fix signed / unsigned mismatch in ktime_to_ns Thomas Gleixner
2006-11-10 18:35 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox