mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andrew Morton <akpm@osdl.org>
Cc: John Stultz <johnstul@us.ibm.com>,
	Roman Zippel <zippel@linux-m68k.org>, Ingo Molnar <mingo@elte.hu>,
	LKML <linux-kernel@vger.kernel.org>,
	Helmut Duregger <Helmut.Duregger@student.uibk.ac.at>
Subject: [patch] ktime: Fix signed / unsigned mismatch in ktime_to_ns
Date: Fri, 10 Nov 2006 18:32:29 -0000	[thread overview]
Message-ID: <20061110182418.134188000@cruncher.tec.linutronix.de> (raw)

[-- 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

--


             reply	other threads:[~2006-11-10 18:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-10 18:32 Thomas Gleixner [this message]
2006-11-10 18:35 ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061110182418.134188000@cruncher.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=Helmut.Duregger@student.uibk.ac.at \
    --cc=akpm@osdl.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®