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>
This commit is contained in:
Julius Werner 2018-11-26 15:57:59 -08:00
parent 5ebcea3aaa
commit e3c2391fca
1 changed files with 2 additions and 2 deletions

View File

@ -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);