summaryrefslogtreecommitdiff
path: root/drivers/firmware/dmi_scan.c
diff options
context:
space:
mode:
authorLuck, Tony <tony.luck@intel.com>2013-11-02 00:59:52 +0400
committerIngo Molnar <mingo@kernel.org>2013-11-03 13:40:12 +0400
commit0841c04d65937ad2808f59c43cb54a92473c8f0e (patch)
tree92159fbcb7821de9ee55f7220e18b2117867ecb3 /drivers/firmware/dmi_scan.c
parentd61ec845e2a2e2763aad3ee3024003ce1bb832cf (diff)
downloadlinux-0841c04d65937ad2808f59c43cb54a92473c8f0e.tar.xz
dmi: Avoid unaligned memory access in save_mem_devices()
Firmware is not required to maintain alignment of SMBIOS entries, so we should take care accessing fields within these structures. Use "get_unaligned()" to avoid problems. [ Found on ia64 (which grumbles about unaligned access) ] Signed-off-by: Tony Luck <tony.luck@intel.com> Cc: Chen Gong <gong.chen@linux.intel.com> Link: http://lkml.kernel.org/r/27d82dbff5be1025bf18ab88498632d36c2fcf3c.1383331440.git.tony.luck@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/firmware/dmi_scan.c')
-rw-r--r--drivers/firmware/dmi_scan.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 59579a744d58..c7e81ff8f3ef 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -8,6 +8,7 @@
#include <linux/bootmem.h>
#include <linux/random.h>
#include <asm/dmi.h>
+#include <asm/unaligned.h>
/*
* DMI stands for "Desktop Management Interface". It is part
@@ -347,7 +348,7 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v)
pr_warn(FW_BUG "Too many DIMM entries in SMBIOS table\n");
return;
}
- dmi_memdev[nr].handle = dm->handle;
+ dmi_memdev[nr].handle = get_unaligned(&dm->handle);
dmi_memdev[nr].device = dmi_string(dm, d[0x10]);
dmi_memdev[nr].bank = dmi_string(dm, d[0x11]);
nr++;