Subject: kern/2250: yet another DIAGNOSTIC message to sys/scsi/sd.c
To: None <gnats-bugs@NetBSD.ORG>
From: None <soda@sra.co.jp>
List: netbsd-bugs
Date: 03/23/1996 15:56:03
>Number: 2250
>Category: kern
>Synopsis: yet another DIAGNOSTIC message to sys/scsi/sd.c
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Mar 23 02:20:03 1996
>Last-Modified:
>Originator: Noriyuki Soda
>Organization:
Software Research Associates, Inc., Japan
>Release: 1.1B
>Environment:
System: NetBSD james 1.1B NetBSD 1.1B (PALM) #1: Sat Mar 23 04:39:30 JST 1996 soda@james:/mnt2/current/src/sys/arch/i386/compile/PALM i386
>Description:
On bad hardware or bad driver, NetBSD silently reboots in boot
sequence, even if it is configured with DDB & DIAGNOSTIC options.
The reason was that SCSI mode sense returns illegal value for
blocksize (> 1M byte), and "dp->disksize / (1048576 / dp->blksize)" on
sys/scsi/sd.c causes "divide by zero"
So, please add yet another diagnostic message to sys/scsi/sd.c, to
ease tracking down what is problem.
>How-To-Repeat:
>Fix:
--- sys/scsi/sd.c- Sun Mar 17 21:29:28 1996
+++ sys/scsi/sd.c Sat Mar 23 14:48:51 1996
@@ -206,10 +206,16 @@
SCSI_AUTOCONF | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_SILENT) ||
sd_get_parms(sd, SCSI_AUTOCONF) != 0)
printf("drive offline\n");
- else
+ else {
+#ifdef DIAGNOSTIC
+ if (dp->blksize <= 0 || 1024*1024 < dp->blksize)
+ panic("%s: %d bytes/sec",
+ sd->sc_dev.dv_xname, dp->blksize);
+#endif
printf("%ldMB, %d cyl, %d head, %d sec, %d bytes/sec\n",
- dp->disksize / (1048576 / dp->blksize), dp->cyls,
+ dp->disksize / (1024*1024 / dp->blksize), dp->cyls,
dp->heads, dp->sectors, dp->blksize);
+ }
}
/*
--
soda@sra.co.jp Software Research Associates, Inc., Japan
(Noriyuki Soda) software tools and technology group
>Audit-Trail:
>Unformatted: