Fix for gcc 4.4 strict aliasing rules
Corresponding to flashrom svn r714.
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
diff --git a/physmap.c b/physmap.c
index 778a783..3a003fe 100644
--- a/physmap.c
+++ b/physmap.c
@@ -133,7 +133,7 @@
msr_t rdmsr(int addr)
{
- uint8_t buf[8];
+ uint32_t buf[2];
msr_t msr = { 0xffffffff, 0xffffffff };
if (lseek(fd_msr, (off_t) addr, SEEK_SET) == -1) {
@@ -143,8 +143,8 @@
}
if (read(fd_msr, buf, 8) == 8) {
- msr.lo = *(uint32_t *)buf;
- msr.hi = *(uint32_t *)(buf + 4);
+ msr.lo = buf[0];
+ msr.hi = buf[1];
return msr;
}