summaryrefslogtreecommitdiff
path: root/lib/rhashtable.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-06-08 05:47:13 +0300
committerTheodore Ts'o <tytso@mit.edu>2017-06-20 05:06:28 +0300
commitd48ad080ec0101c2cca92926bed64993ab565c3d (patch)
tree85a3211479e495739ba9a2763cf2a8095e70f87f /lib/rhashtable.c
parentae5b806a3d3c23d9d3b57aecbe687a0bd82ab086 (diff)
downloadlinux-d48ad080ec0101c2cca92926bed64993ab565c3d.tar.xz
rhashtable: use get_random_u32 for hash_rnd
This is much faster and just as secure. It also has the added benefit of probably returning better randomness at early-boot on systems with architectural RNGs. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Cc: Thomas Graf <tgraf@suug.ch> Cc: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'lib/rhashtable.c')
-rw-r--r--lib/rhashtable.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index d9e7274a04cd..a1eb7c947f46 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -235,7 +235,7 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht,
INIT_LIST_HEAD(&tbl->walkers);
- get_random_bytes(&tbl->hash_rnd, sizeof(tbl->hash_rnd));
+ tbl->hash_rnd = get_random_u32();
for (i = 0; i < nbuckets; i++)
INIT_RHT_NULLS_HEAD(tbl->buckets[i], ht, i);