aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/edd.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/boot/edd.c')
-rw-r--r--arch/x86/boot/edd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/boot/edd.c b/arch/x86/boot/edd.c
index bf4ae6ff518e..067e28cd3c5f 100644
--- a/arch/x86/boot/edd.c
+++ b/arch/x86/boot/edd.c
@@ -43,6 +43,7 @@ static u32 read_mbr_sig(u8 devno, struct edd_info *ei, u32 *mbrsig)
43 char *mbrbuf_ptr, *mbrbuf_end; 43 char *mbrbuf_ptr, *mbrbuf_end;
44 u32 buf_base, mbr_base; 44 u32 buf_base, mbr_base;
45 extern char _end[]; 45 extern char _end[];
46 u16 mbr_magic;
46 47
47 sector_size = ei->params.bytes_per_sector; 48 sector_size = ei->params.bytes_per_sector;
48 if (!sector_size) 49 if (!sector_size)
@@ -60,11 +61,15 @@ static u32 read_mbr_sig(u8 devno, struct edd_info *ei, u32 *mbrsig)
60 if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr) 61 if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr)
61 return -1; 62 return -1;
62 63
64 memset(mbrbuf_ptr, 0, sector_size);
63 if (read_mbr(devno, mbrbuf_ptr)) 65 if (read_mbr(devno, mbrbuf_ptr))
64 return -1; 66 return -1;
65 67
66 *mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET]; 68 *mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET];
67 return 0; 69 mbr_magic = *(u16 *)&mbrbuf_ptr[510];
70
71 /* check for valid MBR magic */
72 return mbr_magic == 0xAA55 ? 0 : -1;
68} 73}
69 74
70static int get_edd_info(u8 devno, struct edd_info *ei) 75static int get_edd_info(u8 devno, struct edd_info *ei)