diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-02-18 23:09:31 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-02-18 23:09:31 +0000 |
commit | 601337fb68d9c8731744d7cd6bbd0ca45377aedb (patch) | |
tree | 63db650df432dc231ca4d6506c4f6cd687b978a7 /sys/dev | |
parent | 27038569322ac3c3f0996db04b2736314f356ee2 (diff) |
do not assume PCI_USERCONF is set on all arch; matthieu ok
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/pci.c | 11 |
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; } |