[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080711135735.28952.84285.stgit@warthog.procyon.org.uk>
Date: Fri, 11 Jul 2008 14:57:35 +0100
From: David Howells <dhowells@...hat.com>
To: gerrit@....abdn.ac.uk, akpm@...ux-foundation.org
Cc: dhowells@...hat.com, acme@...stprotocols.net,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] Fix dccp_timestamp()'s use of do_div()
Fix dccp_timestamps()'s use of do_div() on an s64 by making delta a u64
instead and dividing that.
Possibly this should be guarded lest the interval calculation turn up negative,
but the possible negativity of the result of the division ignored anyway, and,
indeed, should not happen.
This was introduced by patch 4c70f383e0c0273c4092c4efdb414be0966978b7.
Signed-off-by: David Howells <dhowells@...hat.com>
---
net/dccp/timer.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/net/dccp/timer.c b/net/dccp/timer.c
index 8703a79..27218c5 100644
--- a/net/dccp/timer.c
+++ b/net/dccp/timer.c
@@ -300,8 +300,10 @@ static ktime_t dccp_timestamp_seed;
*/
u32 dccp_timestamp(void)
{
- s64 delta = ktime_us_delta(ktime_get_real(), dccp_timestamp_seed);
+ u64 delta = ktime_us_delta(ktime_get_real(), dccp_timestamp_seed);
+ /* This will produce huge values if the current time should happen to
+ * be earlier than the initial timestamp, but that shouldn't happen */
do_div(delta, 10);
return delta;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists