Subject: [PATCH] Fix ghost entries under /sys/firmware/edd take 2 From: Andrey Borzenkov < arvidjaar@mail.ru> Some BIOSes do not indicate error when trying to read from non- existing device. Zero buffer before reading and check that we actually got some data. This was fixed in different way for edd.S in http://marc.info/?l=linux-kernel&m=114087765422490&w=2, but lost again when edd.S was rewritten in C. Signed-off-by: Andrey Borzenkov < arvidjaar@mail.ru> --- arch/x86/boot/edd.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/boot/edd.c b/arch/x86/boot/edd.c index d93cbc6..0388234 100644 --- a/arch/x86/boot/edd.c +++ b/arch/x86/boot/edd.c @@ -58,11 +58,12 @@ static u32 read_mbr_sig(u8 devno, struct edd_info *ei, u32 *mbrsig) if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr) return -1; + memset(mbrbuf_ptr, 0, sector_size); if (read_mbr(devno, mbrbuf_ptr)) return -1; *mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET]; - return 0; + return -!*mbrsig; /* treat zero signature as no sig */ } static int get_edd_info(u8 devno, struct edd_info *ei)