summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Hall <halex@cvs.openbsd.org>2009-11-18 19:57:10 +0000
committerAlexander Hall <halex@cvs.openbsd.org>2009-11-18 19:57:10 +0000
commit184dd7054c1c7919d8f27714327c36fcf61a0366 (patch)
tree1202a199bb2f892149b923dabc7af79d8e6aa0eb /sys
parentdcd88473ccbbe7f2bb5400192de0a6e7c478c637 (diff)
panic on impossible error code
potential off-by-one found by parfait ok deraadt@, krw@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/aic7xxx.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c
index e4c9d9bb9a1..d628f22decb 100644
--- a/sys/dev/ic/aic7xxx.c
+++ b/sys/dev/ic/aic7xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx.c,v 1.82 2008/07/29 21:18:53 miod Exp $ */
+/* $OpenBSD: aic7xxx.c,v 1.83 2009/11/18 19:57:09 halex Exp $ */
/* $NetBSD: aic7xxx.c,v 1.108 2003/11/02 11:07:44 wiz Exp $ */
/*
@@ -40,7 +40,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: aic7xxx.c,v 1.82 2008/07/29 21:18:53 miod Exp $
+ * $Id: aic7xxx.c,v 1.83 2009/11/18 19:57:09 halex Exp $
*/
/*
* Ported from FreeBSD by Pascal Renauld, Network Storage Solutions, Inc. - April 2003
@@ -441,6 +441,8 @@ ahc_handle_brkadrint(struct ahc_softc *ahc)
error = ahc_inb(ahc, ERROR);
for (i = 0; error != 1 && i < num_errors; i++)
error >>= 1;
+ if (i >= num_errors)
+ panic("invalid error code");
printf("%s: brkadrint, %s at seqaddr = 0x%x\n",
ahc_name(ahc), ahc_hard_errors[i].errmesg,
ahc_inb(ahc, SEQADDR0) |