summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2018-11-26 15:57:59 -0800
committerJulius Werner <jwerner@chromium.org>2018-11-27 19:31:26 +0000
commite3c2391fca4464ac4d2862e480ddc93a1434152d (patch)
treed1b1fe753a2b06c61430e31741abb80e32de4e6f
parent5ebcea3aaaa3cd358bc5bccaa156b13a6ef25df6 (diff)
downloadcoreboot-e3c2391fca4464ac4d2862e480ddc93a1434152d.tar.xz
cbmem: Fix remaining mapped memory accesses to use aligned_memcpy()
aligned_memcpy() was introduced to fix issues with platforms that don't allow unaligned accesses to areas mapped with /dev/mem, but we missed a few spots. Fix them. Change-Id: I97ea953455b41a50023ceaca7eb148d60e6b8097 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/29848 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--util/cbmem/cbmem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 8ab80b0a59..90ad55e070 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -279,7 +279,7 @@ static struct lb_cbmem_ref parse_cbmem_ref(const struct lb_cbmem_ref *cbmem_ref)
{
struct lb_cbmem_ref ret;
- ret = *cbmem_ref;
+ aligned_memcpy(&ret, cbmem_ref, sizeof(ret));
if (cbmem_ref->size < sizeof(*cbmem_ref))
ret.cbmem_addr = (uint32_t)ret.cbmem_addr;
@@ -651,7 +651,7 @@ static void dump_timestamps(int mach_readable)
sorted_tst_p = malloc(size);
if (!sorted_tst_p)
die("Failed to allocate memory");
- memcpy(sorted_tst_p, tst_p, size);
+ aligned_memcpy(sorted_tst_p, tst_p, size);
qsort(&sorted_tst_p->entries[0], sorted_tst_p->num_entries,
sizeof(struct timestamp_entry), compare_timestamp_entries);