Subject: kern/21893: division by zero in scsipi_sync_factor_to_freq(): one more quirk in scsiconf.c ?
To: None <gnats-bugs@gnats.netbsd.org>
From: Anthony Mallet <anthony.mallet@useless-ficus.net>
List: netbsd-bugs
Date: 06/15/2003 18:35:03
>Number:         21893
>Category:       kern
>Synopsis:       division by zero in scsipi_sync_factor_to_freq(): one more quirk in scsiconf.c ?
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 15 16:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Anthony Mallet
>Release:        NetBSD 1.6T - 05/15/2003
>Organization:
>Environment:
System: NetBSD ficus 1.6T NetBSD 1.6T (FICUS) #9: Sun Jun 15 18:03:53 CEST 2003 troot@ficus:/home/build/netbsd-obj-current/sys/arch/i386/compile/FICUS i386
Architecture: i386
Machine: i386
>Description:
Something changed in the kernel scsi code between March 30th and today:
my cdrom which was normally detect as 
cd0 at scsibus0 target 3 lun 0: <YAMAHA, CRW8824S, 1.00> cdrom removable
cd0: async, 8-bit transfers

started to insist on printing:
cd0: sync (0.00ns offset 0), 8-bit
followed by a division by zero in scsipi_sync_factor_to_period(0) (the
function was called with factor==0).

Adding a new quirk in scsiconf.c (PQUIRK_NOSYNC) seems to restore the
correct behavior (see the patch below).

Since I actually don't understand anything in the scsi code, I'm not sure
wether this is the right fix or not...

(BTW, all strings in the scsi_quirk_patterns[] array seem to have the
same length except for the YAMAHA entries which are not padded with
spaces... don't know if it's really important)

>How-To-Repeat:
boot -current with a yamaha CRW8824S cdrom
>Fix:
Index: scsiconf.c
===================================================================
RCS file: /pub/NetBSD-CVS/src/sys/dev/scsipi/scsiconf.c,v
retrieving revision 1.205
diff -u -r1.205 scsiconf.c
--- scsiconf.c	2003/05/13 03:02:36	1.205
+++ scsiconf.c	2003/06/15 16:23:41
@@ -495,6 +495,8 @@
 	{{T_CDROM, T_REMOV,
 	 "YAMAHA", "CRW8424S",           ""},     PQUIRK_NOLUNS},
 	{{T_CDROM, T_REMOV,
+	 "YAMAHA", "CRW8824S",           ""},     PQUIRK_NOSYNC},
+	{{T_CDROM, T_REMOV,
 	 "VMware", "Virtual",            "1.0"},
 				PQUIRK_NOSTARTUNIT|PQUIRK_NODOORLOCK},
 	{{T_CDROM, T_REMOV,

>Release-Note:
>Audit-Trail:
>Unformatted: