From owner-freebsd-hackers@FreeBSD.ORG Thu May 13 06:00:23 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B66BB16A4CE; Thu, 13 May 2004 06:00:23 -0700 (PDT) Received: from sev.net.ua (sev.net.ua [212.86.233.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1DD9543D62; Thu, 13 May 2004 06:00:22 -0700 (PDT) (envelope-from shadow@psoft.net) Received: from berloga.shadowland ([213.227.237.65]) by sev.net.ua (8.12.10/8.12.9) with ESMTP id i4DD0JPs075010; Thu, 13 May 2004 16:00:19 +0300 (EEST) (envelope-from shadow@psoft.net) Received: from berloga.shadowland (berloga.shadowland [127.0.0.1]) by berloga.shadowland (8.12.10/8.12.10) with ESMTP id i4DCw5hc010210; Thu, 13 May 2004 15:58:05 +0300 Received: (from root@localhost) by berloga.shadowland (8.12.10/8.12.10/Submit) id i4DCw2HK010208; Thu, 13 May 2004 15:58:02 +0300 From: Alex Lyashkov To: Pawel Jakub Dawidek In-Reply-To: <20040513122919.GQ845@darkness.comp.waw.pl> References: <1084367285.88529.35.camel@singsing> <20040513122919.GQ845@darkness.comp.waw.pl> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: quoted-printable Organization: PSoft Message-Id: <1084453082.7881.17.camel@berloga.shadowland> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 (1.4.5-1) Date: Thu, 13 May 2004 15:58:02 +0300 cc: freebsd-hackers@FreeBSD.org Subject: Re: md(8) panic X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2004 13:00:23 -0000 =F7 =FE=D4=D7, 13.05.2004, =D7 15:29, Pawel Jakub Dawidek =D0=C9=DB=C5=D4: > On Wed, May 12, 2004 at 02:08:05PM +0100, Mike Bristow wrote: > +> Hi, > +>=20 > +> I am trying to access some ancient 5 1/4" floppies, with 256 byte > +> sectors. Leaving aside the interesting hardware problems, the > +> filesystem on these disks is (surprisingly enough) not supported on > +> -CURRENT. While attempting to write one, I ran: > +>=20 > +> # mdconfig -a -t malloc -S 256 -s 20 > +>=20 > +> Thinking that this would give me some fake media to play with. Instea= d, > +> it panics the box. > +>=20 > +> This happens at line 809 of md.c version 1.222 which says: > +>=20 > +> sc->nsect /=3D (sc->secsize / DEV_BSIZE); > +>=20 > +> (where sc->secsize has been initialised to 256, as per=20 > +> my request). > +>=20 > +> It would be easy to check for, and reject, such requests, but should > +> md(8) allow people to create such devices? Or am I being silly in eve= n > +> asking for it? >=20 > This sector size is valid and shouldn't be rejected. > This patch works for me: >=20 > http://people.freebsd.org/~pjd/patches/md.c.3.patch in patch + sc->nsect =3D (mdio->md_size * DEV_BSIZE) / sc->secsize; why not=20 + sc->nsect =3D (mdio->md_size / sc->secsize ) * DEV_BSIZE ; for avoid posible overflow in mdio->md_size * DEV_BSIZE --=20 Alex Lyashkov PSoft