summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2002-02-18 23:09:30 +0000
committerderaadt <deraadt@openbsd.org>2002-02-18 23:09:30 +0000
commit2bc4fe2b5d4de2e1c7dff5064e520e27ca163a64 (patch)
tree027c7200d74fd4cf3c81b63e8309b0689948b00a
parentneed rndvar.h for it to compile (diff)
downloadwireguard-openbsd-2bc4fe2b5d4de2e1c7dff5064e520e27ca163a64.tar.xz
wireguard-openbsd-2bc4fe2b5d4de2e1c7dff5064e520e27ca163a64.zip
do not assume PCI_USERCONF is set on all arch; matthieu ok
-rw-r--r--sys/dev/pci/pci.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index e3728696d42..be00456e4a3 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci.c,v 1.23 2002/02/18 21:51:18 matthieu Exp $ */
+/* $OpenBSD: pci.c,v 1.24 2002/02/18 23:09:30 deraadt Exp $ */
/* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */
/*
@@ -427,9 +427,14 @@ pciioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
goto done;
}
/* Check bounds */
- if (pci.sc_bus >= 256 ||
+#ifdef PCI_USERCONF
+ if (pci.sc_bus >= 256 ||
io->pi_sel.pc_dev >= pci_bus_maxdevs(pc, pci.sc_bus) ||
- io->pi_sel.pc_func >= 8) {
+ error = EINVAL;
+ goto done;
+ }
+#endif
+ if (io->pi_sel.pc_func >= 8) {
error = EINVAL;
goto done;
}