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:
parent
5ebcea3aaa
commit
e3c2391fca
|
@ -279,7 +279,7 @@ static struct lb_cbmem_ref parse_cbmem_ref(const struct lb_cbmem_ref *cbmem_ref)
|
||||||
{
|
{
|
||||||
struct lb_cbmem_ref ret;
|
struct lb_cbmem_ref ret;
|
||||||
|
|
||||||
ret = *cbmem_ref;
|
aligned_memcpy(&ret, cbmem_ref, sizeof(ret));
|
||||||
|
|
||||||
if (cbmem_ref->size < sizeof(*cbmem_ref))
|
if (cbmem_ref->size < sizeof(*cbmem_ref))
|
||||||
ret.cbmem_addr = (uint32_t)ret.cbmem_addr;
|
ret.cbmem_addr = (uint32_t)ret.cbmem_addr;
|
||||||
|
@ -651,7 +651,7 @@ static void dump_timestamps(int mach_readable)
|
||||||
sorted_tst_p = malloc(size);
|
sorted_tst_p = malloc(size);
|
||||||
if (!sorted_tst_p)
|
if (!sorted_tst_p)
|
||||||
die("Failed to allocate memory");
|
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,
|
qsort(&sorted_tst_p->entries[0], sorted_tst_p->num_entries,
|
||||||
sizeof(struct timestamp_entry), compare_timestamp_entries);
|
sizeof(struct timestamp_entry), compare_timestamp_entries);
|
||||||
|
|
Loading…
Reference in New Issue