From 16a8b4ee94b7a9e57e8fc37ad9dd8581bc555caf Mon Sep 17 00:00:00 2001 From: marcel Date: Fri, 3 Apr 2009 05:54:49 +0000 Subject: 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 --- sys/geom/part/g_part_ebr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sys/geom') 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; -- cgit v1.1