Subject: kern/132: Bug in sys/scsi/cd.c
To: None <gnats-admin>
From: Peter Shipley <shipley>
List: netbsd-bugs
Date: 02/18/1994 11:05:07
>Number:         132
>Category:       kern
>Synopsis:       system will crash at boot  if there is not CD rom in drive
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    gnats-admin (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 18 11:05:04 1994
>Originator:     Peter Shipley
>Organization:
"	"
>Release:        
>Environment:
	i486/33 Netbsd-current 2/14/93
	i386/20 Netbsd-current 2/14/93
System: NetBSD loca1host.dis.org 0.9a LOCA1HOST#19 i386


>Description:
	system will panic with a divide by zero error
	If I have a Sun CD rom connected to the SCSI Bus
	and a line in fstab to mount it (at boot).
>How-To-Repeat:
	attach a sun CD rom the a system, add a line to fstab to mount
	and reboot
>Fix:

*** cd.orig	Fri Jan 21 00:23:54 1994
--- cd.c	Fri Jan 21 00:38:19 1994
***************
*** 205,213 ****
  		printf("started ");
  	/*******************************************************\
  	* Load the physical device parameters 			*
  	\*******************************************************/
! 	cd_get_parms(unit, 0);
  	if(scsi_debug & TRACEOPENS)
  		printf("Params loaded ");
  	/*******************************************************\
  	* Load the partition info if not already loaded		*
--- 205,215 ----
  		printf("started ");
  	/*******************************************************\
  	* Load the physical device parameters 			*
  	\*******************************************************/
! 	if( cd_get_parms(unit, 0)) {
! 		return(ENXIO);
! 	}
  	if(scsi_debug & TRACEOPENS)
  		printf("Params loaded ");
  	/*******************************************************\
  	* Load the partition info if not already loaded		*
***************
*** 1035,1044 ****
  		blksize += rdcap.length_2 << 16;
  		blksize += rdcap.length_3 << 24;
  	}
  	if(cd_debug)printf("cd%d: %d %d byte blocks\n",unit,size,blksize);
! 	cd_data[unit]->params.disksize = size;
! 	cd_data[unit]->params.blksize = blksize;
  	return(size);
  }
  	
  /*******************************************************\
--- 1037,1056 ----
  		blksize += rdcap.length_2 << 16;
  		blksize += rdcap.length_3 << 24;
  	}
  	if(cd_debug)printf("cd%d: %d %d byte blocks\n",unit,size,blksize);
! 
! 	if (size < 100) {
! 		cd_data[unit]->params.disksize = 400000;
! 	} else {
! 		cd_data[unit]->params.disksize = size;
! 	}
! 
! 	if (blksize < 512) {
! 		cd_data[unit]->params.blksize = 2048;
! 	} else {
! 		cd_data[unit]->params.blksize = blksize;
! 	}
  	return(size);
  }
  	
  /*******************************************************\
>Audit-Trail:
>Unformatted:


------------------------------------------------------------------------------