From: Jason A. Donenfeld Date: Thu, 8 Jun 2017 02:47:13 +0000 (-0400) Subject: rhashtable: use get_random_u32 for hash_rnd X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d48ad080ec0101c2cca92926bed64993ab565c3d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Cc: Thomas Graf Cc: Herbert Xu Signed-off-by: Theodore Ts'o --- 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);