aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/xt_hashlimit.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2014-08-23 20:58:54 +0200
committerDavid S. Miller <davem@davemloft.net>2014-08-23 12:21:21 -0700
commit8fc54f68919298ff9689d980efb495707ef43f30 (patch)
treec8a0c89621a9e670be02764a357bb6e73ed7ab6c /net/netfilter/xt_hashlimit.c
parentnet: Allow raw buffers to be passed into the flow dissector. (diff)
downloadlinux-dev-8fc54f68919298ff9689d980efb495707ef43f30.tar.xz
linux-dev-8fc54f68919298ff9689d980efb495707ef43f30.zip
net: use reciprocal_scale() helper
Replace open codings of (((u64) <x> * <y>) >> 32) with reciprocal_scale(). Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter/xt_hashlimit.c')
-rw-r--r--net/netfilter/xt_hashlimit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 47dc6836830a..52eb3e03458d 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -135,7 +135,7 @@ hash_dst(const struct xt_hashlimit_htable *ht, const struct dsthash_dst *dst)
* give results between [0 and cfg.size-1] and same hash distribution,
* but using a multiply, less expensive than a divide
*/
- return ((u64)hash * ht->cfg.size) >> 32;
+ return reciprocal_scale(hash, ht->cfg.size);
}
static struct dsthash_ent *