From 8e2bca513efc5deccb11cb90bad3c0891c4929e3 Mon Sep 17 00:00:00 2001 From: James Clarke Date: Mon, 17 Oct 2016 21:16:01 +0100 Subject: Fix bus error when accessing MBR partition records Since the MBR layout only has partition records as 2-byte aligned, the 32-bit fields in them are not aligned. Thus, they cannot be accessed on some architectures (such as SPARC) by using a "struct MBR_part_record *" pointer, as the compiler can assume that the pointer is properly aligned. Instead, the records must be accessed by going through the MBR struct itself every time. Signed-off-by: James Clarke Signed-off-by: Jes Sorensen --- part.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'part.h') diff --git a/part.h b/part.h index 862a14c3..e697fb46 100644 --- a/part.h +++ b/part.h @@ -40,7 +40,7 @@ struct MBR_part_record { __u8 last_cyl; __u32 first_sect_lba; __u32 blocks_num; -}; +} __attribute__((packed)); struct MBR { __u8 pad[446]; -- cgit v1.2.3