aboutsummaryrefslogtreecommitdiff
path: root/hdata
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2017-08-23 12:21:45 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-08-24 12:59:15 +1000
commit349ea5b06104a6d23c9533387bfd5f245397911f (patch)
tree1b93da3cdfb43067c40c533a7ef2e64926843aad /hdata
parent9735fcf71abbb23c4621f1371734b785b18fb075 (diff)
downloadskiboot-349ea5b06104a6d23c9533387bfd5f245397911f.zip
skiboot-349ea5b06104a6d23c9533387bfd5f245397911f.tar.gz
skiboot-349ea5b06104a6d23c9533387bfd5f245397911f.tar.bz2
hdata/iohub: fix load of misaligned address for type 'long unsigned int', which requires 8 byte alignment
UBSan caught this: hdata/test/../iohub.c:83:2: runtime error: load of misaligned address 0x7f1dc7b0210a for type 'long unsigned int', which requires 8 byte alignment 0x7f1dc7b0210a: note: pointer points here 31 4c 58 08 31 00 04 01 00 30 00 42 50 46 02 00 00 78 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ #0 0x41470a in io_get_lx_info hdata/test/../iohub.c:83 #1 0x41759f in io_add_p8_cec_vpd hdata/test/../iohub.c:450 #2 0x417d35 in io_parse_fru hdata/test/../iohub.c:538 #3 0x41812a in io_parse hdata/test/../iohub.c:600 #4 0x425aa2 in parse_hdat hdata/test/../spira.c:1337 #5 0x43d9f8 in main hdata/test/hdata_to_dt.c:358 #6 0x7f1dcb868509 in __libc_start_main (/lib64/libc.so.6+0x20509) #7 0x4019e9 in _start (/home/stewart/skiboot/hdata/test/hdata_to_dt+0x4019e9) Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata')
-rw-r--r--hdata/iohub.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/hdata/iohub.c b/hdata/iohub.c
index aecb640..79a6b07 100644
--- a/hdata/iohub.c
+++ b/hdata/iohub.c
@@ -63,6 +63,7 @@ static bool io_get_lx_info(const void *kwvpd, unsigned int kwvpd_sz,
{
const void *lxr;
char recname[5];
+ uint32_t lxrbuf[2] = { 0, 0 };
/* Find LXRn, where n is the index passed in*/
strcpy(recname, "LXR0");
@@ -80,16 +81,18 @@ static bool io_get_lx_info(const void *kwvpd, unsigned int kwvpd_sz,
return false;
}
- prlog(PR_DEBUG, "CEC: LXRn=%d LXR=%016lx\n", lx_idx,
- lxr ? *(unsigned long *)lxr : 0);
+ if (lxr)
+ memcpy(lxrbuf, lxr, sizeof(uint32_t)*2);
+
+ prlog(PR_DEBUG, "CEC: LXRn=%d LXR=%08x%08x\n", lx_idx, lxrbuf[0], lxrbuf[1]);
prlog(PR_DEBUG, "CEC: LX Info added to %llx\n", (long long)hn);
/* Add the LX info */
if (!dt_has_node_property(hn, "ibm,vpd-lx-info", NULL)) {
dt_add_property_cells(hn, "ibm,vpd-lx-info",
lx_idx,
- ((uint32_t *)lxr)[0],
- ((uint32_t *)lxr)[1]);
+ lxrbuf[0],
+ lxrbuf[1]);
}
return true;