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: [EMAIL PROTECTED]

Index: scsi_da.c
===================================================================
RCS file: /home/ncvs/src/sys/cam/scsi/scsi_da.c,v
retrieving revision 1.19.2.5
diff -u -r1.19.2.5 scsi_da.c
--- scsi_da.c   1999/05/22 22:58:27     1.19.2.5
+++ scsi_da.c   1999/07/03 07:24:35
@@ -1326,7 +1326,7 @@
                        dp = &softc->params;
                        snprintf(announce_buf, sizeof(announce_buf),
                                "%ldMB (%d %d byte sectors: %dH %dS/T %dC)",
-                               dp->sectors / ((1024L * 1024L) / dp->secsize),
+                               dp->secsize * dp->sectors / (1024L * 1024L),
                                dp->sectors, dp->secsize, dp->heads,
                                dp->secs_per_track, dp->cylinders);
                } else {

Reply via email to