From owner-svn-src-head@FreeBSD.ORG Fri Apr 3 05:54:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62AAD106566B; Fri, 3 Apr 2009 05:54:50 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 519748FC12; Fri, 3 Apr 2009 05:54:50 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n335soqZ007600; Fri, 3 Apr 2009 05:54:50 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n335so8a007599; Fri, 3 Apr 2009 05:54:50 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200904030554.n335so8a007599@svn.freebsd.org> From: Marcel Moolenaar Date: Fri, 3 Apr 2009 05:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190667 - head/sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Apr 2009 05:54:50 -0000 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;