[PATCH] Fix netfilter xt_time's time_mt()'s use of do_div() - Kernel

This is a discussion on [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div() - 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 --- 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 ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div()

  1. [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div()

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

    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 */

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

  2. Re: [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div()

    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?

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

  3. Re: [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div()


    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.
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  4. Re: [PATCH] Fix netfilter xt_time's time_mt()'s use of do_div()

    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.

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

+ Reply to Thread