Skip to content

Commit

Permalink
rhashtable: use get_random_u32 for hash_rnd
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jason A. Donenfeld authored and Theodore Ts'o committed Jun 20, 2017
1 parent ae5b806 commit d48ad08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rhashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d48ad08

Please sign in to comment.