Subject: kern/17573: Incorrect SCSI defect descriptor structures
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ginsbach@cray.com>
List: netbsd-bugs
Date: 07/12/2002 08:53:21
>Number:         17573
>Category:       kern
>Synopsis:       Incorrect SCSI defect descriptor structures
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 12 06:54:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Brian Ginsbach
>Release:        NetBSD 1.5.2, current
>Organization:
Cray Inc.
>Environment:
System: NetBSD nbtest.cray.com 1.5.2 NetBSD 1.5.2 (NBTEST) #1: Wed Feb 20 03:38:32 CST 2002 ginsbach@nbtest.cray.com:/usr/src/sys/arch/i386/compile/NBTEST i386


>Description:
	The structures scsi_defect_descriptor_bfif (bytes from index
	format) and scsi_defect_descriptor_psf (physical sector formt)
	in scsi_disk.h are too small.  This is according to the SCSI II
	specification (tables 114 and 115).  These two structures should
	be 8 bytes in size not the current 5 bytes.  In both structures
	the cylinder is 3 bytes while the bytes from index or sector
	are 4 bytes.

>How-To-Repeat:
	By inspection or attempt to use these too small structures to
	read defect data from a drive.

>Fix:
Index: scsi_disk.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/scsipi/scsi_disk.h,v
retrieving revision 1.20
diff -u -r1.20 scsi_disk.h
--- scsi_disk.h	2001/09/03 17:14:49	1.20
+++ scsi_disk.h	2002/07/12 13:46:41
@@ -121,16 +121,16 @@
 
 /* Bytes from index format */
 struct scsi_defect_descriptor_bfif {
-	u_int8_t cylinder[2];
+	u_int8_t cylinder[3];
 	u_int8_t head;
-	u_int8_t bytes_from_index[2];
+	u_int8_t bytes_from_index[4];
 };
 
 /* Physical sector format */
 struct scsi_defect_descriptor_psf {
-	u_int8_t cylinder[2];
+	u_int8_t cylinder[3];
 	u_int8_t head;
-	u_int8_t sector[2];
+	u_int8_t sector[4];
 };
 
 /*
>Release-Note:
>Audit-Trail:
>Unformatted: