Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Oct 1996 16:06:08 +0100 (BST)
From:      Barry Alan Scott <barry@scottb.demon.co.uk>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   i386/1893: partition tables not processed correctly to guess geometry
Message-ID:  <199610261506.QAA00610@scottb.demon.co.uk>
Resent-Message-ID: <199610261510.IAA00952@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1893
>Category:       i386
>Synopsis:       partition tables not processed correctly to guess geometry
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 26 08:10:01 PDT 1996
>Last-Modified:
>Originator:     Barry Alan Scott
>Organization:
None
>Release:        FreeBSD 2.1-STABLE i386 and all SNAP's to date
>Environment:

	Bug is all FreeBSB since 2.1.5 atleast.

>Description:

	John Gumb and myself are experimenting with supporting the Fujitsu
	640MB MO drives at the 2048 sector size. We found that FreeBSD does
	not process partition tables correctly to size a disk. The following
	code at line 253 in diskslice_machdep.c is badly broken. It is 
	supposed to calculate the max number of cylinders but infact reports
	the number of cylinders in the 4th slot.

	Old code from diskslice_machdep.c around line 253:

	/* Guess the geometry. */
	/*
	 * TODO:
	 * Perhaps skip entries with 0 size.
	 * Perhaps only look at entries of type DOSPTYP_386BSD.
	 */
	max_ncyls = 0;
	max_nsectors = 0;
	max_ntracks = 0;
	for (dospart = 0, dp = dp0; dospart < NDOSPART; dospart++, dp++) {
		int	nsectors;
		int	ntracks;

>How-To-Repeat:

	Make partition slot 4 describe a small part of the whole disk.
	Then the orginal code will get the size of the disk wrong.
	

>Fix:
	
	See above.
>Audit-Trail:
>Unformatted:
>bug>		max_ncyls = DPCYL(dp->dp_ecyl, dp->dp_esect);
>bug>		if (max_ncyls < max_ncyls)
>bug>			max_ncyls = max_ncyls;
		nsectors = DPSECT(dp->dp_esect);
		if (max_nsectors < nsectors)
			max_nsectors = nsectors;
		ntracks = dp->dp_ehd + 1;
		if (max_ntracks < ntracks)
			max_ntracks = ntracks;
	}

	The lines maked ">bug>" are clearly intended to read

		int	ncyls;

		ncyls = DPCYL(dp->dp_ecyl, dp->dp_esect);
		if (max_ncyls < ncyls)
			max_ncyls = ncyls;

	We do not know what the full impact of this bug is. Is this
	related to the "random" MSDOS problems some people see?

	John Gumb can be contacted as john@talisker.demon.co.uk
	Barry Scott can be contacted as barry@scottb.demon.co.uk
	and as tsbarry@nortel.ca (atleast till 31-dec)






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