Skip to content

Commit d48ad08

Browse files
zx2c4tytso
authored andcommitted
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 <[email protected]> Cc: Thomas Graf <[email protected]> Cc: Herbert Xu <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
1 parent ae5b806 commit d48ad08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rhashtable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht,
235235

236236
INIT_LIST_HEAD(&tbl->walkers);
237237

238-
get_random_bytes(&tbl->hash_rnd, sizeof(tbl->hash_rnd));
238+
tbl->hash_rnd = get_random_u32();
239239

240240
for (i = 0; i < nbuckets; i++)
241241
INIT_RHT_NULLS_HEAD(tbl->buckets[i], ht, i);

0 commit comments

Comments
 (0)