svn commit: r190667 - head/sys/geom/part

Marcel Moolenaar marcel at FreeBSD.org
Thu Apr 2 22:54:50 PDT 2009


Author: marcel
Date: Fri Apr  3 05:54:49 2009
New Revision: 190667
URL: http://svn.freebsd.org/changeset/base/190667

Log:
  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 at mmlab.cse.yzu.edu.tw

Modified:
  head/sys/geom/part/g_part_ebr.c

Modified: head/sys/geom/part/g_part_ebr.c
==============================================================================
--- head/sys/geom/part/g_part_ebr.c	Fri Apr  3 03:25:00 2009	(r190666)
+++ head/sys/geom/part/g_part_ebr.c	Fri Apr  3 05:54:49 2009	(r190667)
@@ -403,9 +403,14 @@ g_part_ebr_probe(struct g_part_table *ta
 	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;


More information about the svn-src-head mailing list