netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div()
@ 2008-07-11 14:02 David Howells
  2008-07-15 11:43 ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: David Howells @ 2008-07-11 14:02 UTC (permalink / raw)
  To: jengelh, akpm; +Cc: dhowells, kaber, netdev, linux-kernel

Fix netfilter xt_time's time_mt()'s use of do_div() on an s64 by using
div_s64() instead.

This was introduced by patch ee4411a1b1e0b679c99686629b5eab5a072ce49f.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 net/netfilter/xt_time.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c
index ed76baa..9f32859 100644
--- a/net/netfilter/xt_time.c
+++ b/net/netfilter/xt_time.c
@@ -173,7 +173,7 @@ time_mt(const struct sk_buff *skb, const struct net_device *in,
 		__net_timestamp((struct sk_buff *)skb);
 
 	stamp = ktime_to_ns(skb->tstamp);
-	do_div(stamp, NSEC_PER_SEC);
+	stamp = div_s64(stamp, NSEC_PER_SEC);
 
 	if (info->flags & XT_TIME_LOCAL_TZ)
 		/* Adjust for local timezone */


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div()
  2008-07-11 14:02 [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div() David Howells
@ 2008-07-15 11:43 ` Patrick McHardy
  2008-07-15 12:08   ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2008-07-15 11:43 UTC (permalink / raw)
  To: David Howells; +Cc: jengelh, akpm, netdev, linux-kernel

David Howells wrote:
> Fix netfilter xt_time's time_mt()'s use of do_div() on an s64 by using
> div_s64() instead.
> 
> This was introduced by patch ee4411a1b1e0b679c99686629b5eab5a072ce49f.

Alternatively we could use an u64 for the time. Jan, any preferences?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div()
  2008-07-15 11:43 ` Patrick McHardy
@ 2008-07-15 12:08   ` Jan Engelhardt
  2008-07-15 12:10     ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2008-07-15 12:08 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: David Howells, akpm, netdev, linux-kernel


On Tuesday 2008-07-15 13:43, Patrick McHardy wrote:

> David Howells wrote:
>> Fix netfilter xt_time's time_mt()'s use of do_div() on an s64 by using
>> div_s64() instead.
>> 
>> This was introduced by patch ee4411a1b1e0b679c99686629b5eab5a072ce49f.
>
> Alternatively we could use an u64 for the time. Jan, any preferences?

ktime_t and ktime_to_ns operate on signed quantities. I do not think we 
should be interpreting it as unsigned.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div()
  2008-07-15 12:08   ` Jan Engelhardt
@ 2008-07-15 12:10     ` Patrick McHardy
  0 siblings, 0 replies; 4+ messages in thread
From: Patrick McHardy @ 2008-07-15 12:10 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: David Howells, akpm, netdev, linux-kernel

Jan Engelhardt wrote:
> On Tuesday 2008-07-15 13:43, Patrick McHardy wrote:
> 
>> David Howells wrote:
>>> Fix netfilter xt_time's time_mt()'s use of do_div() on an s64 by using
>>> div_s64() instead.
>>>
>>> This was introduced by patch ee4411a1b1e0b679c99686629b5eab5a072ce49f.
>> Alternatively we could use an u64 for the time. Jan, any preferences?
> 
> ktime_t and ktime_to_ns operate on signed quantities. I do not think we 
> should be interpreting it as unsigned.

OK, I've applied David's patch. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-15 12:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-11 14:02 [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div() David Howells
2008-07-15 11:43 ` Patrick McHardy
2008-07-15 12:08   ` Jan Engelhardt
2008-07-15 12:10     ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).