summaryrefslogtreecommitdiffstats
path: root/sys/geom/part
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2009-01-04 07:32:06 +0000
committermarcel <marcel@FreeBSD.org>2009-01-04 07:32:06 +0000
commit619213ff3f701271abfc79c0c74fd57719b60eba (patch)
tree1884d5fb345de36c64d30dd72ea6ae47a0f95ca5 /sys/geom/part
parent3b04b200c70ee335a09fe12754b68ab98ce59a90 (diff)
downloadFreeBSD-src-619213ff3f701271abfc79c0c74fd57719b60eba.zip
FreeBSD-src-619213ff3f701271abfc79c0c74fd57719b60eba.tar.gz
Improve probing.
o Don't check the dummy fields. o The entry is unused if either dp_mid is 0 or dp_sid is 0. o The start or end cylinder cannot be 0. o The start CHS cannot be equal to the end CHS. Submitted by: nyan
Diffstat (limited to 'sys/geom/part')
-rw-r--r--sys/geom/part/g_part_pc98.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/geom/part/g_part_pc98.c b/sys/geom/part/g_part_pc98.c
index f0f1474..c7d9d97 100644
--- a/sys/geom/part/g_part_pc98.c
+++ b/sys/geom/part/g_part_pc98.c
@@ -333,7 +333,7 @@ g_part_pc98_probe(struct g_part_table *table, struct g_consumer *cp)
struct g_provider *pp;
u_char *buf, *p;
int error, index, res, sum;
- uint16_t magic;
+ uint16_t magic, ecyl, scyl;
pp = cp->provider;
@@ -365,11 +365,15 @@ g_part_pc98_probe(struct g_part_table *table, struct g_consumer *cp)
for (index = 0; index < NDOSPART; index++) {
p = buf + SECSIZE + index * DOSPARTSIZE;
- if (p[2] != 0 || p[3] != 0)
- goto out;
- if (p[1] == 0)
+ if (p[0] == 0 || p[1] == 0) /* !dp_mid || !dp_sid */
continue;
- if (le16dec(p + 10) == 0)
+ scyl = le16dec(p + 10);
+ ecyl = le16dec(p + 14);
+ if (scyl == 0 || ecyl == 0)
+ goto out;
+ if (p[8] == p[12] && /* dp_ssect == dp_esect */
+ p[9] == p[13] && /* dp_shd == dp_ehd */
+ scyl == ecyl)
goto out;
}
OpenPOWER on IntegriCloud