From eb722282da73f6afbe44f486eae6e64b9e00c568 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Thu, 31 Jan 2019 09:40:26 -0700 Subject: [PATCH] cbmem: use aligned_memcpy for reading cbmem address information The coreboot table entry containing the memory entries can have fields unnaturally aligned in memory. Therefore one needs to perform an aligned_memcpy() so that it doesn't cause faults on certain architectures that assume naturally aligned accesses. BUG=chromium:925961 Change-Id: I28365b204962ac89d65d046076d862b6f9374c06 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/c/31181 Tested-by: build bot (Jenkins) Reviewed-by: Manoj Gupta Reviewed-by: Furquan Shaikh Reviewed-by: Julius Werner --- util/cbmem/cbmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c index 8e73d9c28d..fc2dcdcc75 100644 --- a/util/cbmem/cbmem.c +++ b/util/cbmem/cbmem.c @@ -302,7 +302,7 @@ static void parse_memory_tags(const struct lb_memory *mem) continue; debug(" LB_MEM_TABLE found.\n"); /* The last one found is CBMEM */ - cbmem = mem->map[i]; + aligned_memcpy(&cbmem, &mem->map[i], sizeof(cbmem)); } }