aboutsummaryrefslogtreecommitdiff
path: root/ubifs-utils
diff options
context:
space:
mode:
authorYuanjie Huang <Yuanjie.Huang@windriver.com>2017-03-02 10:43:56 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2017-03-02 10:43:56 +0100
commit7d026a85946a08b8167dcd792ea6660bf6a49e08 (patch)
treee5679d9197ceced8d7fa488c34b1d34e6b317552 /ubifs-utils
parentd7e86124d55bbcee1b82c68b82389ebcda588076 (diff)
Fix alignment trap triggered by NEON instructions
NEON instruction VLD1.64 was used to copy 64 bits data after type casting, and they will trigger alignment trap. This patch uses memcpy to avoid alignment problem. Signed-off-by: Yuanjie Huang <Yuanjie.Huang@windriver.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils')
-rw-r--r--ubifs-utils/mkfs.ubifs/key.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/ubifs-utils/mkfs.ubifs/key.h b/ubifs-utils/mkfs.ubifs/key.h
index 39379fd..118858b 100644
--- a/ubifs-utils/mkfs.ubifs/key.h
+++ b/ubifs-utils/mkfs.ubifs/key.h
@@ -159,10 +159,12 @@ static inline void data_key_init(union ubifs_key *key, ino_t inum,
*/
static inline void key_write(const union ubifs_key *from, void *to)
{
- union ubifs_key *t = to;
+ __le32 x[2];
- t->j32[0] = cpu_to_le32(from->u32[0]);
- t->j32[1] = cpu_to_le32(from->u32[1]);
+ x[0] = cpu_to_le32(from->u32[0]);
+ x[1] = cpu_to_le32(from->u32[1]);
+
+ memcpy(to, &x, 8);
memset(to + 8, 0, UBIFS_MAX_KEY_LEN - 8);
}
@@ -174,10 +176,12 @@ static inline void key_write(const union ubifs_key *from, void *to)
*/
static inline void key_write_idx(const union ubifs_key *from, void *to)
{
- union ubifs_key *t = to;
+ __le32 x[2];
+
+ x[0] = cpu_to_le32(from->u32[0]);
+ x[1] = cpu_to_le32(from->u32[1]);
- t->j32[0] = cpu_to_le32(from->u32[0]);
- t->j32[1] = cpu_to_le32(from->u32[1]);
+ memcpy(to, &x, 8);
}
/**