From 8ac17c44056db77049211be0a2f85d337e0f4766 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 13 Sep 2016 11:59:20 +0100 Subject: [PATCH] mbr: make alignment/padding safe --- Kernel/dev/mbr.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Kernel/dev/mbr.c b/Kernel/dev/mbr.c index f914ec25..8c4006c4 100644 --- a/Kernel/dev/mbr.c +++ b/Kernel/dev/mbr.c @@ -7,10 +7,9 @@ #include typedef struct { - uint8_t status; - uint8_t chs_first[3]; - uint8_t type; - uint8_t chs_last[3]; + /* Described this way so that it packs */ + uint8_t status_chs_first[4]; + uint8_t type_chs_last[4]; uint32_t lba_first; uint32_t lba_count; } partition_table_entry_t; @@ -70,7 +69,7 @@ void mbr_parse(char letter) blk_op.lba = 0; for(i=0; ipartition[i].type){ + switch(br->partition[i].type_chs_last[0]){ case 0: break; case 0x05: -- 2.34.1