Skip to content

Commit

Permalink
of: Feed entire flattened device tree into the random pool
Browse files Browse the repository at this point in the history
We feed the entire DMI table into the random pool to provide
better random data during early boot, so do the same with the
flattened device tree.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
  • Loading branch information
Anton Blanchard authored and Grant Likely committed Aug 30, 2013
1 parent 4485681 commit 109b623
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/of/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/random.h>

#include <asm/setup.h> /* for COMMAND_LINE_SIZE */
#ifdef CONFIG_PPC
Expand Down Expand Up @@ -726,3 +727,14 @@ void __init unflatten_device_tree(void)
}

#endif /* CONFIG_OF_EARLY_FLATTREE */

/* Feed entire flattened device tree into the random pool */
static int __init add_fdt_randomness(void)
{
if (initial_boot_params)
add_device_randomness(initial_boot_params,
be32_to_cpu(initial_boot_params->totalsize));

return 0;
}
core_initcall(add_fdt_randomness);

0 comments on commit 109b623

Please sign in to comment.