Skip to contentSkip to conversation

common: remove unaligned access error in bootmenu_getoption()

PATCH In review Lan Yixun (dlan) 2 participants 2 messages Jun 27, 2013 – Jul 16, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: remove unaligned access error in bootmenu_getoption()

From: "Lan Yixun (dlan)" <[email protected]>

Some ARM compilers may emit code that makes unaligned accesses when faced with constructs such as:

    char name[12] = "bootmenu_";

same fix as commit: 064d55f8bc8d7d205ed0be6abb6717e92eeb7cad

=========================================================
data abort

MAYBE you should read doc/README.arm-unaligned-accesses

pc : [<3ff4b60c>]          lr : [<3ff4b7b0>]

sp : 3f346a58 ip : 3ff9c8e6 fp : 02000060
r10: 00000000 r9 : 3df47fc0 r8 : 3f347f40
r7 : 00000000 r6 : 00000000 r5 : 00000003 r4 : 3f759140
r3 : 000003f0 r2 : 00000000 r1 : 000003f1 r0 : 00000000
Flags: nzCv IRQs on FIQs off Mode SVC_32
Resetting CPU ...
======================================================

---
 common/cmd_bootmenu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/cmd_bootmenu.c +2 -2
index 7041273..d414c17 100644
@@ -65,12 +65,12 @@ enum bootmenu_key {
 
 static char *bootmenu_getoption(unsigned short int n)
 {
-	char name[MAX_ENV_SIZE] = "bootmenu_";
+	char name[MAX_ENV_SIZE];
 
 	if (n > MAX_COUNT)
 		return NULL;
 
-	sprintf(name + 9, "%d", n);
+	sprintf(name, "bootmenu_%d", n);
 	return getenv(name);
 }
 
Signature · 1 line
1.8.2.1
#1 lore raw
Quoted 8 lines · Dennis Lan (dlan)

From: "Lan Yixun (dlan)" <[email protected]>

Some ARM compilers may emit code that makes unaligned accesses when faced with constructs such as:

    char name[12] = "bootmenu_";

same fix as commit: 064d55f8bc8d7d205ed0be6abb6717e92eeb7cad

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130716/6041e5d8/attachment.pgp>