Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Apr 2009 05:54:50 +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: r190667 - head/sys/geom/part
Message-ID:  <200904030554.n335so8a007599@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904030554.n335so8a007599>