Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!uunet!mcsun!hp4nl!utrcu1!mi.eltn.utwente.nl!klamer From: klamer@mi.eltn.utwente.nl (Klamer Schutte) Newsgroups: comp.os.minix Subject: atari-st 1.5.10 #3 stfloppy.c fix Keywords: atari, 1.5.10#3 only Message-ID: Date: 8 Apr 91 12:27:50 GMT Sender: news@utrcu1.UUCP Organization: University of Twente, BSC-El Lines: 86 As i already announced in an earlier message, there is a bug in kernel/stfloppy.c which produces a kernel panic. The bug is that there is divided through a possible-zero number. The fix is to check for this and give a proper error. (return EINVAL). Fix is relative to minix 1.5.10#3. Don't apply it to plain 1.5.10. Don't think about 1.1 ;-) Both plaintext and uud version follow. Klamer echo x - stfloppy.c.cdi sed '/^X/s///' > stfloppy.c.cdi << '/' X*** 1.1 1991/04/08 10:37:42 X--- stfloppy.c 1991/04/08 11:06:14 X*************** X*** 538,552 **** X if (ret != SECTOR_SIZE) X return(ret); X nr_sec[d] = sh88tosh68(block0.b0_spt); X- nr_cyl[d] = sh88tosh68(block0.b0_nsects) / nr_sec[d]; X nr_hds[d] = sh88tosh68(block0.b0_nsides); X /* safety first: check for plausible values */ X /* assume that #sectors is between 8 (old dos) and 18 (hd diskettes) */ X if ((nr_sec[d] < 8) || (nr_sec[d] > 18)) return(EINVAL); X- /* assume that #cylinders is either 40 (5 1/4" dos) or between 78 and 85 */ X- if ((nr_cyl[d] != 40) && (nr_cyl[d] < 78) || (nr_cyl[d] > 85)) return(EINVAL); X /* definitely must have either one or two heads */ X if ((nr_hds[d] != 1) && (nr_hds[d] != 2)) return(EINVAL); X return(0); X } X #endif X--- 538,553 ---- X if (ret != SECTOR_SIZE) X return(ret); X nr_sec[d] = sh88tosh68(block0.b0_spt); X nr_hds[d] = sh88tosh68(block0.b0_nsides); X /* safety first: check for plausible values */ X /* assume that #sectors is between 8 (old dos) and 18 (hd diskettes) */ X if ((nr_sec[d] < 8) || (nr_sec[d] > 18)) return(EINVAL); X /* definitely must have either one or two heads */ X if ((nr_hds[d] != 1) && (nr_hds[d] != 2)) return(EINVAL); X+ /* now is know that nr_sec and nr_hds are not zero there can de divided */ X+ nr_cyl[d] = sh88tosh68(block0.b0_nsects) / (nr_sec[d]*nr_hds[d]); X+ /* assume that #cylinders is either 40 (5 1/4" dos) or between 78 and 85 */ X+ if ((nr_cyl[d] != 40) && (nr_cyl[d] < 78) || (nr_cyl[d] > 85)) return(EINVAL); X return(0); X } X #endif / echo x - stfloppy.uue sed '/^X/s///' > stfloppy.uue << '/' Xtable X !"#$%&'()*+,-./0123456789:;<=>? X@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ Xbegin 644 stfloppy.c.cdi.Z XM'YV-*@*"B.$B1H(8.7+$> &#!D,< V'HF'%#!PT9"EIH!#&'CADV;^# R>-Bz XMS,&$"QL^'!A#!PP;.F+04!"PILV;*F@*K#$#!XL:-62 L*D A%$0:OGZ10-8w XM,&'#B!6[B3N&SIP4(%Z B$S:\MJCJ]^B(3/'\EV.F?O^#3SX3>'#B;^,3D.Fv XMS.G71U^HX!C&C-,\(,RDD=-1!X@Q:.2NB?Y&#@@X;,+4F9-F'F3.G3IOS=-"$>3J"=%_J2,T!@AA.W5%&&6Z !$*;[!!!@AD^(5:t XM&&X\&,."LT&8QAQK.$6'<:BI\!YL22V% FMRV<:#@JCQP<=2*,Y5%P@^#(1#s XM"JB-5=99123AA!5!,.%8"\G)1Y]]^.G'WV1LI%%A&0!N"$(9:>0')0@TP+!4r XM#0.]0(,($$H(0G<#%GA@@C= 1.&#.' IXF-&E8C"B6\Q:5M46,* F@DFP%@Gq XM92J"D&:++](I&: SUM@FCB#H:!8*/?X8I&.P*0=A&=*Y4649;$#7QGA/Z6?'p XM>51:Z=T;;IQ')AUWO %"=F'0YAY\B+7!U@C($A&4AEMQ)-/0,T @D8:T:H46D_A29556&G%E5?PB>74n XMCN!2"ME;K@2<>>>:AIQY[ KY9J9'UW0="?ON!T)]<_PDH)8&LGJG@l XM4@T^&.%I(*QIXU(93LNAAR#.2N*WAL9KUXHW@N"BGW"EF*B-PZ[[:*3']AO?k XMI9ENVBD(GW;T:ABC3EEE=J>F.J9WK+H*JZPB'U5K9+<".Q"O3,>=:[!1DS6Uj XML9.NM4*1J[UQ1X @K.&&X"*WYMQ4X$_I :6KIIXW!H67:F@'i XM<64\^.;?_AY:6Y99=?AHDSF3 ;B*"@:C[>YJR\O_WGZ7;AF27=AMHYXXJ#*EUHg X79.+;I6@->;-+==_P+=LL6,\:%6V%U +>f X e Xend / -- Klamer Schutte Faculty of electrical engineering -- University of Twente, The Netherlands klamer@mi.eltn.utwente.nl {backbone}!mcsun!mi.eltn.utwente.nl!klamer