From owner-freebsd-current Sat Jul 3 11:37: 8 1999 Delivered-To: freebsd-current@freebsd.org Received: from feral.com (feral.com [192.67.166.1]) by hub.freebsd.org (Postfix) with ESMTP id AEF1F15211; Sat, 3 Jul 1999 11:36:51 -0700 (PDT) (envelope-from mjacob@feral.com) Received: from semuta.feral.com (semuta [192.67.166.70]) by feral.com (8.8.7/8.8.7) with ESMTP id LAA03197; Sat, 3 Jul 1999 11:36:32 -0700 Date: Sat, 3 Jul 1999 11:35:55 -0700 (PDT) From: Matthew Jacob Reply-To: mjacob@feral.com To: Nick Hibma Cc: FreeBSD CURRENT Mailing list , justin@FreeBSD.ORG Subject: Re: panic in dadone, PR 12041 In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'll fix it, but not this way. It's time to prepare for handling larger than terabyte disks that still have a 512 byte sector size as well. The actual calculation should be: (((u_int64_t) dp->secsize) * ((u_int64_t) dp->sectors)) >> 20LL and the format statement should be %qdMB for the Megabyte size. On Sat, 3 Jul 1999, Nick Hibma wrote: > > PR 12041 complains about the fact that the system panics with a divide > by zero if a zip drive is connected with a medium in it. I've not been > able to reproduce the problem, but remember having similar problems > when implementing the umass driver for USB. The problem is caused by the > following line in scsi_da.c:1326 (3.2-STABLE but applies to CURRENT as > well): > > snprintf(announce_buf, sizeof(announce_buf), > "%ldMB (%d %d byte sectors: %dH %dS/T%dC)", > dp->sectors / ((1024L * 1024L) / dp->secsize), > dp->sectors, dp->secsize, dp->heads, > dp->secs_per_track, dp->cylinders); > > secsize is 0 in some cases (I think it happens when an INQUIRY fails > without being detected as having failed). > > In any case a/(b/c) = a*c/b, but without any divl (with b sometimes 0 > and c == 2^20). > > Patch attached. > > Nick > > -- > e-Mail: hibma@skylink.it > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message