From 29500b20c034767b13369412909154976151ca47 Mon Sep 17 00:00:00 2001 From: thorpej Date: Sun, 19 Oct 1997 18:56:39 +0000 Subject: [PATCH] Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before using the address in a bus_space_map() call. --- sys/arch/i386/isa/fd.c | 6 +++++- sys/arch/i386/isa/lms.c | 6 +++++- sys/dev/isa/aha_isa.c | 6 +++++- sys/dev/isa/aic_isa.c | 6 +++++- sys/dev/isa/ast.c | 6 +++++- sys/dev/isa/bha_isa.c | 6 +++++- sys/dev/isa/boca.c | 6 +++++- sys/dev/isa/com_isa.c | 6 +++++- sys/dev/isa/cy_isa.c | 6 +++++- sys/dev/isa/i82365_isa.c | 6 +++++- sys/dev/isa/if_ed.c | 18 +++++++++++++++++- sys/dev/isa/if_eg.c | 6 +++++- sys/dev/isa/if_le_isa.c | 6 +++++- sys/dev/isa/lpt_isa.c | 6 +++++- sys/dev/isa/mcd.c | 6 +++++- sys/dev/isa/rtfps.c | 6 +++++- sys/dev/isa/uha_isa.c | 6 +++++- sys/dev/isa/wds.c | 6 +++++- sys/dev/isa/wt.c | 6 +++++- 19 files changed, 107 insertions(+), 19 deletions(-) diff --git a/sys/arch/i386/isa/fd.c b/sys/arch/i386/isa/fd.c index 3e3e36407b00..18d91e1e743c 100644 --- a/sys/arch/i386/isa/fd.c +++ b/sys/arch/i386/isa/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.111 1997/10/13 00:46:34 explorer Exp $ */ +/* $NetBSD: fd.c,v 1.112 1997/10/19 19:00:20 thorpej Exp $ */ /*- * Copyright (c) 1993, 1994, 1995, 1996 @@ -271,6 +271,10 @@ fdcprobe(parent, match, aux) iot = ia->ia_iot; rv = 0; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == IOBASEUNK) + return 0; + /* Map the i/o space. */ if (bus_space_map(iot, ia->ia_iobase, FDC_NPORT, 0, &ioh)) return 0; diff --git a/sys/arch/i386/isa/lms.c b/sys/arch/i386/isa/lms.c index dbd7bfdfe7e4..c29b9d9cc813 100644 --- a/sys/arch/i386/isa/lms.c +++ b/sys/arch/i386/isa/lms.c @@ -1,4 +1,4 @@ -/* $NetBSD: lms.c,v 1.30 1996/10/21 22:27:41 thorpej Exp $ */ +/* $NetBSD: lms.c,v 1.31 1997/10/19 19:00:24 thorpej Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. @@ -95,6 +95,10 @@ lmsprobe(parent, match, aux) bus_space_handle_t ioh; int rv; + /* Disallow wildcarded i/o base. */ + if (ia->ia_iobase == IOBASEUNK) + return 0; + /* Map the i/o space. */ if (bus_space_map(iot, ia->ia_iobase, LMS_NPORTS, 0, &ioh)) return 0; diff --git a/sys/dev/isa/aha_isa.c b/sys/dev/isa/aha_isa.c index 5a50928b38bd..126ea604aaab 100644 --- a/sys/dev/isa/aha_isa.c +++ b/sys/dev/isa/aha_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: aha_isa.c,v 1.5 1997/08/27 11:25:04 bouyer Exp $ */ +/* $NetBSD: aha_isa.c,v 1.6 1997/10/19 18:56:39 thorpej Exp $ */ /* * Copyright (c) 1994, 1996, 1997 Charles M. Hannum. All rights reserved. @@ -81,6 +81,10 @@ aha_isa_probe(parent, match, aux) struct aha_probe_data apd; int rv; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + if (bus_space_map(iot, ia->ia_iobase, AHA_ISA_IOSIZE, 0, &ioh)) return (0); diff --git a/sys/dev/isa/aic_isa.c b/sys/dev/isa/aic_isa.c index a34519c631ac..0d703c4f33f2 100644 --- a/sys/dev/isa/aic_isa.c +++ b/sys/dev/isa/aic_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: aic_isa.c,v 1.2 1997/10/16 22:55:34 enami Exp $ */ +/* $NetBSD: aic_isa.c,v 1.3 1997/10/19 18:56:43 thorpej Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Charles M. Hannum. All rights reserved. @@ -105,6 +105,10 @@ aic_isa_probe(parent, match, aux) bus_space_handle_t ioh; int rv; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + if (bus_space_map(iot, ia->ia_iobase, AIC_ISA_IOSIZE, 0, &ioh)) return (0); diff --git a/sys/dev/isa/ast.c b/sys/dev/isa/ast.c index 8475a970a4fe..0289c40d3267 100644 --- a/sys/dev/isa/ast.c +++ b/sys/dev/isa/ast.c @@ -1,4 +1,4 @@ -/* $NetBSD: ast.c,v 1.39 1997/10/16 00:29:28 thorpej Exp $ */ +/* $NetBSD: ast.c,v 1.40 1997/10/19 18:56:46 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -101,6 +101,10 @@ astprobe(parent, self, aux) * XXX Needs more robustness. */ + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + /* if the first port is in use as console, then it. */ if (com_is_console(iot, iobase, 0)) goto checkmappings; diff --git a/sys/dev/isa/bha_isa.c b/sys/dev/isa/bha_isa.c index 4c280a53ecfc..a9229b092abd 100644 --- a/sys/dev/isa/bha_isa.c +++ b/sys/dev/isa/bha_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: bha_isa.c,v 1.8 1997/08/27 11:25:07 bouyer Exp $ */ +/* $NetBSD: bha_isa.c,v 1.9 1997/10/19 18:56:48 thorpej Exp $ */ /* * Copyright (c) 1994, 1996, 1997 Charles M. Hannum. All rights reserved. @@ -81,6 +81,10 @@ bha_isa_probe(parent, match, aux) struct bha_probe_data bpd; int rv; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + if (bus_space_map(iot, ia->ia_iobase, BHA_ISA_IOSIZE, 0, &ioh)) return (0); diff --git a/sys/dev/isa/boca.c b/sys/dev/isa/boca.c index e0ae50814e44..7830e52b53c7 100644 --- a/sys/dev/isa/boca.c +++ b/sys/dev/isa/boca.c @@ -1,4 +1,4 @@ -/* $NetBSD: boca.c,v 1.25 1997/10/16 00:29:30 thorpej Exp $ */ +/* $NetBSD: boca.c,v 1.26 1997/10/19 18:56:50 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -93,6 +93,10 @@ bocaprobe(parent, self, aux) * XXX Needs more robustness. */ + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + /* if the first port is in use as console, then it. */ if (com_is_console(iot, iobase, 0)) goto checkmappings; diff --git a/sys/dev/isa/com_isa.c b/sys/dev/isa/com_isa.c index 27bf66d90d1f..746066518092 100644 --- a/sys/dev/isa/com_isa.c +++ b/sys/dev/isa/com_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: com_isa.c,v 1.8 1997/10/16 00:29:32 thorpej Exp $ */ +/* $NetBSD: com_isa.c,v 1.9 1997/10/19 18:56:52 thorpej Exp $ */ /*- * Copyright (c) 1993, 1994, 1995, 1996 @@ -95,6 +95,10 @@ com_isa_probe(parent, match, aux) int rv = 1; struct isa_attach_args *ia = aux; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + iot = ia->ia_iot; iobase = ia->ia_iobase; diff --git a/sys/dev/isa/cy_isa.c b/sys/dev/isa/cy_isa.c index 991170fe738a..8f71a662de4d 100644 --- a/sys/dev/isa/cy_isa.c +++ b/sys/dev/isa/cy_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: cy_isa.c,v 1.5 1996/10/21 22:40:36 thorpej Exp $ */ +/* $NetBSD: cy_isa.c,v 1.6 1997/10/19 18:56:54 thorpej Exp $ */ /* * cy.c @@ -45,6 +45,10 @@ cy_probe_isa(parent, match, aux) sc.sc_memt = ia->ia_memt; sc.sc_bustype = CY_BUSTYPE_ISA; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + if (ia->ia_irq == IRQUNK) { printf("%s: interrupt not defined\n", sc.sc_dev.dv_xname); return 0; diff --git a/sys/dev/isa/i82365_isa.c b/sys/dev/isa/i82365_isa.c index cbb3f416c608..370724e8337c 100644 --- a/sys/dev/isa/i82365_isa.c +++ b/sys/dev/isa/i82365_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: i82365_isa.c,v 1.2 1997/10/16 23:21:41 thorpej Exp $ */ +/* $NetBSD: i82365_isa.c,v 1.3 1997/10/19 18:56:55 thorpej Exp $ */ #define PCICISADEBUG @@ -99,6 +99,10 @@ pcic_isa_probe(parent, match, aux) bus_space_handle_t ioh, memh; int val, found; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + if (bus_space_map(iot, ia->ia_iobase, PCIC_IOSIZE, 0, &ioh)) return (0); diff --git a/sys/dev/isa/if_ed.c b/sys/dev/isa/if_ed.c index e192abfc862d..cd0228490495 100644 --- a/sys/dev/isa/if_ed.c +++ b/sys/dev/isa/if_ed.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ed.c,v 1.116 1997/10/15 05:58:59 explorer Exp $ */ +/* $NetBSD: if_ed.c,v 1.117 1997/10/19 18:57:00 thorpej Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -269,6 +269,14 @@ ed_find_WD80x3(sc, cf, ia) memsize = 8192; isa16bit = 0; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + + /* Disallow wildcarded mem address. */ + if (ia->ia_maddr == ISACF_IOMEM_DEFAULT) + return (0); + if (bus_space_map(iot, ia->ia_iobase, ED_WD_IO_PORTS, 0, &ioh)) return (0); @@ -709,6 +717,14 @@ ed_find_3Com(sc, cf, ia) iot = ia->ia_iot; memt = ia->ia_memt; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + + /* Disallow wildcarded mem address. */ + if (ia->ia_maddr == ISACF_IOMEM_DEFAULT) + return (0); + if (bus_space_map(iot, ia->ia_iobase, ED_3COM_IO_PORTS, 0, &ioh)) return (0); diff --git a/sys/dev/isa/if_eg.c b/sys/dev/isa/if_eg.c index 16078e10314d..c4e516eed1a6 100644 --- a/sys/dev/isa/if_eg.c +++ b/sys/dev/isa/if_eg.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_eg.c,v 1.37 1997/10/15 05:59:16 explorer Exp $ */ +/* $NetBSD: if_eg.c,v 1.38 1997/10/19 18:57:04 thorpej Exp $ */ /* * Copyright (c) 1993 Dean Huxley @@ -343,6 +343,10 @@ egprobe(parent, match, aux) return 0; } + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + /* Map i/o space. */ if (bus_space_map(iot, ia->ia_iobase, 0x08, 0, &ioh)) { DPRINTF(("egprobe: can't map i/o space in probe\n")); diff --git a/sys/dev/isa/if_le_isa.c b/sys/dev/isa/if_le_isa.c index 8eaf7a068208..8815fbb4d4aa 100644 --- a/sys/dev/isa/if_le_isa.c +++ b/sys/dev/isa/if_le_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_isa.c,v 1.13 1997/09/10 03:31:31 mycroft Exp $ */ +/* $NetBSD: if_le_isa.c,v 1.14 1997/10/19 18:57:06 thorpej Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -171,6 +171,10 @@ le_isa_probe(parent, match, aux) struct le_softc *lesc = match; struct isa_attach_args *ia = aux; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + if (bicc_isa_probe(lesc, ia)) return (1); if (ne2100_isa_probe(lesc, ia)) diff --git a/sys/dev/isa/lpt_isa.c b/sys/dev/isa/lpt_isa.c index d8878f04f0f2..ffaf351ae7f3 100644 --- a/sys/dev/isa/lpt_isa.c +++ b/sys/dev/isa/lpt_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: lpt_isa.c,v 1.45 1997/10/14 15:50:21 is Exp $ */ +/* $NetBSD: lpt_isa.c,v 1.46 1997/10/19 18:57:09 thorpej Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. @@ -173,6 +173,10 @@ lpt_isa_probe(parent, match, aux) #define ABORT goto out #endif + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + iot = ia->ia_iot; base = ia->ia_iobase; if (bus_space_map(iot, base, LPT_NPORTS, 0, &ioh)) diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c index 57bb7b260193..89130b63b0f7 100644 --- a/sys/dev/isa/mcd.c +++ b/sys/dev/isa/mcd.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcd.c,v 1.55 1997/10/08 23:10:06 thorpej Exp $ */ +/* $NetBSD: mcd.c,v 1.56 1997/10/19 18:57:11 thorpej Exp $ */ /* * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -867,6 +867,10 @@ mcdprobe(parent, match, aux) bus_space_handle_t ioh; int rv; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + /* Map i/o space */ if (bus_space_map(iot, ia->ia_iobase, MCD_NPORT, 0, &ioh)) return 0; diff --git a/sys/dev/isa/rtfps.c b/sys/dev/isa/rtfps.c index 41bca1b3baef..8a5eb2a4a564 100644 --- a/sys/dev/isa/rtfps.c +++ b/sys/dev/isa/rtfps.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtfps.c,v 1.33 1997/10/16 00:29:36 thorpej Exp $ */ +/* $NetBSD: rtfps.c,v 1.34 1997/10/19 18:57:15 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -95,6 +95,10 @@ rtfpsprobe(parent, self, aux) * XXX Needs more robustness. */ + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + /* if the first port is in use as console, then it. */ if (com_is_console(iot, iobase, 0)) goto checkmappings; diff --git a/sys/dev/isa/uha_isa.c b/sys/dev/isa/uha_isa.c index c846e9c2df31..dfa5433fed94 100644 --- a/sys/dev/isa/uha_isa.c +++ b/sys/dev/isa/uha_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: uha_isa.c,v 1.9 1997/08/27 11:25:11 bouyer Exp $ */ +/* $NetBSD: uha_isa.c,v 1.10 1997/10/19 18:57:17 thorpej Exp $ */ /* * Copyright (c) 1994, 1996, 1997 Charles M. Hannum. All rights reserved. @@ -95,6 +95,10 @@ uha_isa_probe(parent, match, aux) struct uha_probe_data upd; int rv; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + if (bus_space_map(iot, ia->ia_iobase, UHA_ISA_IOSIZE, 0, &ioh)) return (0); diff --git a/sys/dev/isa/wds.c b/sys/dev/isa/wds.c index 51790ff39a06..fac18f611974 100644 --- a/sys/dev/isa/wds.c +++ b/sys/dev/isa/wds.c @@ -1,4 +1,4 @@ -/* $NetBSD: wds.c,v 1.21 1997/09/26 04:00:09 mycroft Exp $ */ +/* $NetBSD: wds.c,v 1.22 1997/10/19 18:57:19 thorpej Exp $ */ #undef WDSDIAG #ifdef DDB @@ -281,6 +281,10 @@ wdsprobe(parent, match, aux) struct wds_probe_data wpd; int rv; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + if (bus_space_map(iot, ia->ia_iobase, WDS_ISA_IOSIZE, 0, &ioh)) return (0); diff --git a/sys/dev/isa/wt.c b/sys/dev/isa/wt.c index d1f628d63b2e..fdf56e2780a4 100644 --- a/sys/dev/isa/wt.c +++ b/sys/dev/isa/wt.c @@ -1,4 +1,4 @@ -/* $NetBSD: wt.c,v 1.39 1997/08/08 09:38:18 jonathan Exp $ */ +/* $NetBSD: wt.c,v 1.40 1997/10/19 18:57:22 thorpej Exp $ */ /* * Streamer tape driver. @@ -200,6 +200,10 @@ wtprobe(parent, match, aux) int rv = 0; + /* Disallow wildcarded i/o address. */ + if (ia->ia_iobase == ISACF_PORT_DEFAULT) + return (0); + /* Map i/o space */ if (bus_space_map(iot, ia->ia_iobase, AV_NPORT, 0, &ioh)) return 0;