LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andries Brouwer <Andries.Brouwer@cwi.nl>
To: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>,
akpm@osdl.org, torvalds@osdl.org
Cc: Andries Brouwer <Andries.Brouwer@cwi.nl>, linux-kernel@vger.kernel.org
Subject: [PATCH] Re: rfc: test whether a device has a partition table
Date: Sat, 22 May 2004 19:45:23 +0200 [thread overview]
Message-ID: <20040522174523.GA1475@apps.cwi.nl> (raw)
In-Reply-To: <16559.28240.860047.83057@hertz.ikp.physik.tu-darmstadt.de>
On Sat, May 22, 2004 at 05:14:24PM +0200, Uwe Bonnes wrote:
> Yes, the test for 0x80/0 is sufficant.
Good.
> + if ( (p->boot_ind != 0x80) && (p->boot_ind!= 0x0))
> + return 0;
You'll need a "put_dev_sector(sect);" as well. Say,
--- msdos.c~ 2003-12-18 03:58:58
+++ msdos.c 2004-05-22 19:38:00
@@ -389,8 +389,23 @@
put_dev_sector(sect);
return 0;
}
+
+ /*
+ * Now that the 55aa signature is present, this is probably
+ * either the boot sector of a FAT filesystem or a DOS-type
+ * partition table. Reject this in case the boot indicator
+ * is not 0 or 0x80.
+ */
p = (struct partition *) (data + 0x1be);
+ for (slot = 1; slot <= 4; slot++, p++) {
+ if (p->boot_ind != 0 && p->boot_ind != 0x80) {
+ put_dev_sector(sect);
+ return 0;
+ }
+ }
+
#ifdef CONFIG_EFI_PARTITION
+ p = (struct partition *) (data + 0x1be);
for (slot = 1 ; slot <= 4 ; slot++, p++) {
/* If this is an EFI GPT disk, msdos should ignore it. */
if (SYS_IND(p) == EFI_PMBR_OSTYPE_EFI_GPT) {
@@ -398,8 +413,8 @@
return 0;
}
}
- p = (struct partition *) (data + 0x1be);
#endif
+ p = (struct partition *) (data + 0x1be);
/*
* Look for partitions in two passes:
Andries
[Linus, Andrew - I have no objections against this.]
prev parent reply other threads:[~2004-05-22 17:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-22 11:18 Uwe Bonnes
2004-05-22 12:37 ` John Bradford
2004-05-22 12:56 ` Andries Brouwer
2004-05-22 15:14 ` Uwe Bonnes
2004-05-22 17:45 ` Andries Brouwer [this message]
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=20040522174523.GA1475@apps.cwi.nl \
--to=andries.brouwer@cwi.nl \
--cc=akpm@osdl.org \
--cc=bon@elektron.ikp.physik.tu-darmstadt.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--subject='[PATCH] Re: rfc: test whether a device has a partition table' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).