summaryrefslogtreecommitdiff
path: root/sys/dev/isa
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2009-06-02 12:12:36 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2009-06-02 12:12:36 +0000
commited860fe1c7cf8fc0126e575e7a620e567cbe5cdb (patch)
treeea34cbf24a526f8200adb95d8576a2179ad46bb5 /sys/dev/isa
parent091923e0232ec2771385260914d34fc49c12a6a4 (diff)
Cope with logical device numbers gaps, this fixes out-of-bounds access
in an array. Problem found and ok deraadt@.
Diffstat (limited to 'sys/dev/isa')
-rw-r--r--sys/dev/isa/gscsio.c8
-rw-r--r--sys/dev/isa/gscsioreg.h5
2 files changed, 6 insertions, 7 deletions
diff --git a/sys/dev/isa/gscsio.c b/sys/dev/isa/gscsio.c
index 1a7b7dd5bd0..9f583fe365c 100644
--- a/sys/dev/isa/gscsio.c
+++ b/sys/dev/isa/gscsio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gscsio.c,v 1.10 2009/03/29 21:53:52 sthen Exp $ */
+/* $OpenBSD: gscsio.c,v 1.11 2009/06/02 12:12:35 grange Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
@@ -42,9 +42,9 @@ struct gscsio_softc {
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
- int sc_ld_en[GSCSIO_LDNUM];
- bus_space_handle_t sc_ld_ioh0[GSCSIO_LDNUM];
- bus_space_handle_t sc_ld_ioh1[GSCSIO_LDNUM];
+ int sc_ld_en[GSCSIO_LDN_LAST + 1];
+ bus_space_handle_t sc_ld_ioh0[GSCSIO_LDN_LAST + 1];
+ bus_space_handle_t sc_ld_ioh1[GSCSIO_LDN_LAST + 1];
/* ACCESS.bus */
struct gscsio_acb {
diff --git a/sys/dev/isa/gscsioreg.h b/sys/dev/isa/gscsioreg.h
index 134e27a2714..212f7585e82 100644
--- a/sys/dev/isa/gscsioreg.h
+++ b/sys/dev/isa/gscsioreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: gscsioreg.h,v 1.2 2004/11/17 16:53:05 mickey Exp $ */
+/* $OpenBSD: gscsioreg.h,v 1.3 2009/06/02 12:12:35 grange Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
@@ -29,6 +29,7 @@
#define GSCSIO_LDN 0x07 /* logical device number */
#define GSCSIO_LDN_ACB1 0x05 /* ACCESS.bus 1 */
#define GSCSIO_LDN_ACB2 0x06 /* ACCESS.bus 2 */
+#define GSCSIO_LDN_LAST 0x08 /* last logical device number */
#define GSCSIO_ID 0x20 /* SIO ID */
#define GSCSIO_ID_SC1100 0xf5 /* Geode SC1100 ID */
#define GSCSIO_CFG1 0x21 /* configuration 1 */
@@ -47,8 +48,6 @@
#define GSCSIO_DMA0 0x74 /* DMA channel 0 */
#define GSCSIO_DMA1 0x75 /* DMA channel 1 */
-#define GSCSIO_LDNUM 6 /* total number of logical devices */
-
/* ACB (ACCESS.bus) logical device registers */
#define GSCSIO_ACB_SDA 0x00 /* serial data */
#define GSCSIO_ACB_ST 0x01 /* status */