init: call time_init() before rand_initialize()
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 5 May 2022 00:20:22 +0000 (02:20 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 13 May 2022 21:59:22 +0000 (23:59 +0200)
commitfe222a6ca2d53c38433cba5d3be62a39099e708e
tree7d94c73a3012d87d6f8a07267cf17c6e2eb648fd
parent069c4ea6871c18bd368f27756e0f91ffb524a788
init: call time_init() before rand_initialize()

Currently time_init() is called after rand_initialize(), but
rand_initialize() makes use of the timer on various platforms, and
sometimes this timer needs to be initialized by time_init() first. In
order for random_get_entropy() to not return zero during early boot when
it's potentially used as an entropy source, reverse the order of these
two calls. The block doing random initialization was right before
time_init() before, so changing the order shouldn't have any complicated
effects.

Cc: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Stafford Horne <shorne@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
init/main.c