Patchwork [U-Boot,V2] disk: fix unaligned access in efi partitions

login
register
mail settings
Submitter Marc Dietrich
Date March 29, 2013, 5:57 p.m.
Message ID <93f22fdc6befbb84cf7ff9519dea43c7a0ccec3d.1364579605.git.marvin24@gmx.de>
Download mbox | patch
Permalink /patch/232471/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Marc Dietrich - March 29, 2013, 5:57 p.m.
start_sect is not aligned to a 4 byte boundary thus causing exceptions
on ARM platforms. Access this field via the get_unaligned_le32 macro.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
---
V2: replace le32_to_cpu(get_unaligned()) with get_unaligned_le32

 disk/part_efi.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Tom Rini - April 3, 2013, 3:29 p.m.
On Fri, Mar 29, 2013 at 07:57:10AM -0000, Marc Dietrich wrote:

> start_sect is not aligned to a 4 byte boundary thus causing exceptions
> on ARM platforms. Access this field via the get_unaligned_le32 macro.
> 
> Signed-off-by: Marc Dietrich <marvin24@gmx.de>

Applied to u-boot/master, thanks!

Patch

diff --git a/disk/part_efi.c b/disk/part_efi.c
index b3fd0e9..e9987f0 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -30,6 +30,7 @@ 
  *
  * This limits the maximum size of addressable storage to < 2 Terra Bytes
  */
+#include <asm/unaligned.h>
 #include <common.h>
 #include <command.h>
 #include <ide.h>
@@ -505,7 +506,7 @@  err:
 static int pmbr_part_valid(struct partition *part)
 {
 	if (part->sys_ind == EFI_PMBR_OSTYPE_EFI_GPT &&
-		le32_to_cpu(part->start_sect) == 1UL) {
+		get_unaligned_le32(&part->start_sect) == 1UL) {
 		return 1;
 	}