[PATCH] dmi: Feed DMI table to /dev/random driver

From: Tony Luck
Date: Fri Jul 20 2012 - 16:40:52 EST


Send the entire DMI (SMBIOS) table to the /dev/random driver to
help seed its pools.

Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---

This looks a useful addition to your /dev/random series. There are
lots of platform specific goodies in this table (BIOS version, system
serial number and UUID, count and version number of processors, DIMM
slot population and serial numbers, etc.)

On the system I tested the patch on the table is 9866 bytes. Is it
OK to dump that much into add_device_randomness() in one shot? The
alternative is to select the 'useful' bits deeper into the routines
that parse the entries in the table.

drivers/firmware/dmi_scan.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 153980b..b298158 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -6,6 +6,7 @@
#include <linux/dmi.h>
#include <linux/efi.h>
#include <linux/bootmem.h>
+#include <linux/random.h>
#include <asm/dmi.h>

/*
@@ -111,6 +112,8 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,

dmi_table(buf, dmi_len, dmi_num, decode, NULL);

+ add_device_randomness(buf, dmi_len);
+
dmi_iounmap(buf, dmi_len);
return 0;
}
--
1.7.10.2.552.gaa3bb87

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/