summaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2013-07-29 05:11:50 +0200
committerGrant Likely <grant.likely@linaro.org>2013-08-30 12:34:34 +0200
commit109b6236294b53d8eaa50be7d9e9ad37079f5f7e (patch)
treeada92373fe06ffa4773bfd939e3284c0bea5cef6 /drivers/of
parentof/fdt: Clean up casting in unflattening path (diff)
downloadlinux-109b6236294b53d8eaa50be7d9e9ad37079f5f7e.tar.xz
linux-109b6236294b53d8eaa50be7d9e9ad37079f5f7e.zip
of: Feed entire flattened device tree into the random pool
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>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/fdt.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 4c5ee96bf487..543c5002831e 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -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
@@ -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);