Date: Sun, 4 Jan 2009 07:32:07 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r186733 - head/sys/geom/part Message-ID: <200901040732.n047W7c4049310@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Sun Jan 4 07:32:06 2009 New Revision: 186733 URL: http://svn.freebsd.org/changeset/base/186733 Log: 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 Modified: head/sys/geom/part/g_part_pc98.c Modified: head/sys/geom/part/g_part_pc98.c ============================================================================== --- head/sys/geom/part/g_part_pc98.c Sun Jan 4 07:29:04 2009 (r186732) +++ head/sys/geom/part/g_part_pc98.c Sun Jan 4 07:32:06 2009 (r186733) @@ -333,7 +333,7 @@ g_part_pc98_probe(struct g_part_table *t 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 *t 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901040732.n047W7c4049310>