aboutsummaryrefslogtreecommitdiff
path: root/bl2/src
diff options
context:
space:
mode:
authorTamas Ban <tamas.ban@arm.com>2019-02-18 14:21:35 +0000
committerTamas Ban <tamas.ban@arm.com>2019-02-21 16:29:50 +0000
commitc43181daf54f69f53de58593a50dd6a9c233eecd (patch)
tree4ca322a8de52f98882087e47c7a7d159388185dd /bl2/src
parent8bd24b79aa7de29fe433b1df9e7d7c44e3c7b9ac (diff)
downloadtrusted-firmware-m-c43181daf54f69f53de58593a50dd6a9c233eecd.tar.gz
Attest: Fix unaligned access issue
Use memory primitives to copy data instead of pointer casting and dereferencing when memory address can be unaligned. Change-Id: I71ed1a63a1a8c8699a1680c82b934094e8ab5db3 Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Diffstat (limited to 'bl2/src')
-rw-r--r--bl2/src/boot_record.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bl2/src/boot_record.c b/bl2/src/boot_record.c
index e24d2c4f11..21c1904374 100644
--- a/bl2/src/boot_record.c
+++ b/bl2/src/boot_record.c
@@ -280,7 +280,8 @@ boot_add_data_to_shared_area(uint8_t major_type,
* returns with error: SHARED_MEMORY_OVERWRITE
*/
for (; offset < tlv_end; offset += tlv_entry.tlv_len) {
- tlv_entry = *((struct shared_data_tlv_entry *)offset);
+ /* Create local copy to avoid unaligned access */
+ memcpy(&tlv_entry, (const void *)offset, SHARED_DATA_ENTRY_HEADER_SIZE);
if (GET_MAJOR(tlv_entry.tlv_type) == major_type &&
GET_MINOR(tlv_entry.tlv_type) == minor_type) {
return SHARED_MEMORY_OVERWRITE;