mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@newmail.ru>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] Ghost EDD devices in /sys again
Date: Sun, 28 Sep 2008 10:34:58 +0400	[thread overview]
Message-ID: <200809281035.06547.arvidjaar@newmail.ru> (raw)
In-Reply-To: <200809062208.m86M8hJM016685@terminus.zytor.com>


[-- Attachment #1.1: Type: text/plain, Size: 572 bytes --]

On Sunday 07 September 2008, H. Peter Anvin wrote:
> 
> I think this is closer to what we really want; after all, memory being written is the "first principles" test that applies here.
> 

OK I have been using this for some time. I do not actually insist on
returning "failure" for zero signature; my main concern was duplicated
signature resulted from not clearing read buffer. Still I assume that
zero signature is the same as no signature; i.e. even if disk is physically
present but zeroed out there is no point in presenting mbr_signature in
sysfs either.

[-- Attachment #1.2: fix-edd-detection-v2 --]
[-- Type: text/x-diff, Size: 1168 bytes --]

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)

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2008-09-28  6:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-06 22:08 H. Peter Anvin
2008-09-28  6:34 ` Andrey Borzenkov [this message]
2008-09-28 15:12   ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2008-09-05 18:19 Andrey Borzenkov
2008-09-06  8:40 ` [PATCH] " Andrey Borzenkov
2008-09-06 12:07   ` Ingo Molnar
2008-09-06 14:34     ` Ingo Molnar
2008-09-06 14:04   ` H. Peter Anvin
2008-09-06 17:46     ` Andrey Borzenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200809281035.06547.arvidjaar@newmail.ru \
    --to=arvidjaar@newmail.ru \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome