]> code.ossystems Code Review - openembedded-core.git/commitdiff
mtd-utils: Fix alignment trap triggered by NEON instructions
authorYuanjie Huang <Yuanjie.Huang@windriver.com>
Wed, 22 Oct 2014 08:47:57 +0000 (04:47 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 4 Nov 2014 10:19:53 +0000 (10:19 +0000)
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: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-devtools/mtd/mtd-utils/fix-armv7-neon-alignment.patch [new file with mode: 0644]
meta/recipes-devtools/mtd/mtd-utils_git.bb

diff --git a/meta/recipes-devtools/mtd/mtd-utils/fix-armv7-neon-alignment.patch b/meta/recipes-devtools/mtd/mtd-utils/fix-armv7-neon-alignment.patch
new file mode 100644 (file)
index 0000000..05f1629
--- /dev/null
@@ -0,0 +1,44 @@
+Upstream-Status: Pending
+
+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>
+
+diff --git a/mkfs.ubifs/key.h b/mkfs.ubifs/key.h
+index d3a02d4..e7e9218 100644
+--- a/mkfs.ubifs/key.h
++++ b/mkfs.ubifs/key.h
+@@ -141,10 +141,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);
+ }
+@@ -156,10 +158,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);
+ }
+ /**
index f78bc7e7f98a53cb30ff794ea24fab7362958054..52297c63ba5dd04af3cfaae4db257c72f26fc498 100644 (file)
@@ -10,6 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
 SRCREV = "9f107132a6a073cce37434ca9cda6917dd8d866b"
 SRC_URI = "git://git.infradead.org/mtd-utils.git \
                file://add-exclusion-to-mkfs-jffs2-git-2.patch \
+               file://fix-armv7-neon-alignment.patch \
 "
 
 PV = "1.5.1+git${SRCPV}"