diff options
author | mjacob <mjacob@FreeBSD.org> | 2005-04-14 03:52:50 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2005-04-14 03:52:50 +0000 |
commit | 524960baf8cb03ea56c2fcc0d25d5af54a02a088 (patch) | |
tree | fe5bd23d2a4f9737c04f70bc2dc681f537f325b2 /sys/cam/scsi | |
parent | 7402cb6da62357b6b730f6cc7046cc761c574a62 (diff) | |
download | FreeBSD-src-524960baf8cb03ea56c2fcc0d25d5af54a02a088.zip FreeBSD-src-524960baf8cb03ea56c2fcc0d25d5af54a02a088.tar.gz |
The divide by zero panic must have been due to a bogus
period value. I suppose the BT adapter driver should be
fixed, but more importantly we should protect against
dividing by zero.
PR: kern/75603
MFC after: 1 week
Diffstat (limited to 'sys/cam/scsi')
-rw-r--r-- | sys/cam/scsi/scsi_all.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index bade90b..4c51148 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -2312,6 +2312,15 @@ scsi_calc_syncsrate(u_int period_factor) int i; int num_syncrates; + /* + * It's a bug if period is zero, but if it is anyway, don't + * die with a divide fault- instead return something which + * 'approximates' async + */ + if (period_factor == 0) { + return (3300); + } + num_syncrates = sizeof(scsi_syncrates) / sizeof(scsi_syncrates[0]); /* See if the period is in the "exception" table */ for (i = 0; i < num_syncrates; i++) { |