From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 17:21:46 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D729E1065670; Sat, 25 Oct 2008 17:21:46 +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 C592C8FC1E; Sat, 25 Oct 2008 17:21:46 +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 m9PHLkgx040568; Sat, 25 Oct 2008 17:21:46 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9PHLkLx040567; Sat, 25 Oct 2008 17:21:46 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200810251721.m9PHLkLx040567@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 25 Oct 2008 17:21:46 +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: r184264 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2008 17:21:47 -0000 Author: marcel Date: Sat Oct 25 17:21:46 2008 New Revision: 184264 URL: http://svn.freebsd.org/changeset/base/184264 Log: Invalid BSD disklabels have been created by sysinstall and are possibly still being created. The d_secperunit field contains the number of sectors of the disk and not of the slice/partition to which the disklabel applies. Rather than reject the disklabel, we now silently adjust the field. Existing code, like bslabel(8), does not seem to check the label that extensively and seems to adjust fields as a side-effect as well. In other words, it's not that important apparently, so gpart should not be too strict about it. Reported by: nyan@ Reported by: Andriy Gapon Modified: head/sys/geom/part/g_part_bsd.c Modified: head/sys/geom/part/g_part_bsd.c ============================================================================== --- head/sys/geom/part/g_part_bsd.c Sat Oct 25 16:29:28 2008 (r184263) +++ head/sys/geom/part/g_part_bsd.c Sat Oct 25 17:21:46 2008 (r184264) @@ -341,8 +341,13 @@ g_part_bsd_read(struct g_part_table *bas printf("GEOM: %s: geometry does not match label.\n", pp->name); chs = le32dec(buf + 60); - if (chs < 1 || chs > msize) + if (chs < 1) goto invalid_label; + /* Fix-up a sysinstall bug. */ + if (chs > msize) { + chs = msize; + le32enc(buf + 60, msize); + } if (chs != msize) printf("GEOM: %s: media size does not match label.\n", pp->name);