]> granicus.if.org Git - ipset/commitdiff
Use MSEC_PER_SEC instead of harcoded value
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 15 May 2012 13:31:10 +0000 (15:31 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 15 May 2012 13:31:10 +0000 (15:31 +0200)
David Laight and Eric Dumazet noticed that we were using hardcoded
1000 instead of MSEC_PER_SEC to calculate the timeout.

kernel/include/linux/netfilter/ipset/ip_set_timeout.h
kernel/net/netfilter/xt_set.c

index 9fba34f84587978248195d63afda6662815f5dfb..41d9cfa081671fdfea95e59a53b8ee20ef9ea211 100644 (file)
@@ -31,8 +31,8 @@ ip_set_timeout_uget(struct nlattr *tb)
        unsigned int timeout = ip_set_get_h32(tb);
 
        /* Normalize to fit into jiffies */
-       if (timeout > UINT_MAX/1000)
-               timeout = UINT_MAX/1000;
+       if (timeout > UINT_MAX/MSEC_PER_SEC)
+               timeout = UINT_MAX/MSEC_PER_SEC;
 
        /* Userspace supplied TIMEOUT parameter: adjust crazy size */
        return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout;
index e97a31b86ae10628a0f79c4b1ac566fe901b8405..035960ec5cb9c8f51b51e48d6909ebb112047f93 100644 (file)
@@ -310,8 +310,8 @@ set_target_v2(struct sk_buff *skb, const struct xt_action_param *par)
                info->del_set.flags, 0, UINT_MAX);
 
        /* Normalize to fit into jiffies */
-       if (add_opt.timeout > UINT_MAX/1000)
-               add_opt.timeout = UINT_MAX/1000;
+       if (add_opt.timeout > UINT_MAX/MSEC_PER_SEC)
+               add_opt.timeout = UINT_MAX/MSEC_PER_SEC;
        if (info->add_set.index != IPSET_INVALID_ID)
                ip_set_add(info->add_set.index, skb, par, &add_opt);
        if (info->del_set.index != IPSET_INVALID_ID)