blob: 05f1629d581b244e634e9e47ca2a0d541037c746 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001Upstream-Status: Pending
2
3NEON instruction VLD1.64 was used to copy 64 bits data after type
4casting, and they will trigger alignment trap.
5This patch uses memcpy to avoid alignment problem.
6
7Signed-off-by: Yuanjie Huang <Yuanjie.Huang@windriver.com>
8
9diff --git a/mkfs.ubifs/key.h b/mkfs.ubifs/key.h
10index d3a02d4..e7e9218 100644
11--- a/mkfs.ubifs/key.h
12+++ b/mkfs.ubifs/key.h
13@@ -141,10 +141,12 @@ static inline void data_key_init(union ubifs_key *key, ino_t inum,
14 */
15 static inline void key_write(const union ubifs_key *from, void *to)
16 {
17- union ubifs_key *t = to;
18+ __le32 x[2];
19
20- t->j32[0] = cpu_to_le32(from->u32[0]);
21- t->j32[1] = cpu_to_le32(from->u32[1]);
22+ x[0] = cpu_to_le32(from->u32[0]);
23+ x[1] = cpu_to_le32(from->u32[1]);
24+
25+ memcpy(to, &x, 8);
26 memset(to + 8, 0, UBIFS_MAX_KEY_LEN - 8);
27 }
28
29@@ -156,10 +158,12 @@ static inline void key_write(const union ubifs_key *from, void *to)
30 */
31 static inline void key_write_idx(const union ubifs_key *from, void *to)
32 {
33- union ubifs_key *t = to;
34+ __le32 x[2];
35+
36+ x[0] = cpu_to_le32(from->u32[0]);
37+ x[1] = cpu_to_le32(from->u32[1]);
38
39- t->j32[0] = cpu_to_le32(from->u32[0]);
40- t->j32[1] = cpu_to_le32(from->u32[1]);
41+ memcpy(to, &x, 8);
42 }
43
44 /**