summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2009-04-03 05:54:49 +0000
committermarcel <marcel@FreeBSD.org>2009-04-03 05:54:49 +0000
commit16a8b4ee94b7a9e57e8fc37ad9dd8581bc555caf (patch)
treeb025f6f65b744a34ad2e3c1c6fe079c81b35872c /sys/geom
parentfda8fbfa9c5fb3d53ce6d6e9556a0038ef8b4597 (diff)
downloadFreeBSD-src-16a8b4ee94b7a9e57e8fc37ad9dd8581bc555caf.zip
FreeBSD-src-16a8b4ee94b7a9e57e8fc37ad9dd8581bc555caf.tar.gz
The 9 bytes immediately prior to the partition table can contain
signatures or disk serial numbers. Don't assume those to be zero in all cases. This fixes a false negative. Tested by: avatar@mmlab.cse.yzu.edu.tw
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/part/g_part_ebr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/geom/part/g_part_ebr.c b/sys/geom/part/g_part_ebr.c
index 82b728d..e3e2867 100644
--- a/sys/geom/part/g_part_ebr.c
+++ b/sys/geom/part/g_part_ebr.c
@@ -403,9 +403,14 @@ g_part_ebr_probe(struct g_part_table *table, struct g_consumer *cp)
if (magic != DOSMAGIC)
goto out;
- /* The sector is all zeroes, except for the partition entries. */
+ /*
+ * The sector is all zeroes, except for the partition entries
+ * and some signatures or disk serial number. Those can be
+ * found in the 9 bytes immediately in front of the partition
+ * table.
+ */
sum = 0;
- for (index = 0; index < DOSPARTOFF; index++)
+ for (index = 0; index < DOSPARTOFF - 9; index++)
sum += buf[index];
if (sum != 0)
goto out;
OpenPOWER on IntegriCloud