From 22060bbfdaefd7d50bbf759a1798cad5d275e0bc Mon Sep 17 00:00:00 2001 From: deraadt Date: Wed, 5 Jan 2022 16:46:11 +0000 Subject: [PATCH] Compensate for i386 pcitag_t union ok jsg kettenis --- sys/dev/pci/pci.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 608929a0b7f..7ca542c29fe 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.122 2022/01/04 16:15:28 kettenis Exp $ */ +/* $OpenBSD: pci.c,v 1.123 2022/01/05 16:46:11 deraadt Exp $ */ /* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */ /* @@ -1264,15 +1264,20 @@ pciioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return EINVAL; pc = pci->sc_pc; - tag = pci_make_tag(pc, sel->pc_bus, sel->pc_dev, sel->pc_func); - LIST_FOREACH(pd, &pci->sc_devs, pd_next) { - if (tag == pd->pd_tag) + int bus, dev, func; + + pci_decompose_tag(pc, pd->pd_tag, &bus, &dev, &func); + + if (bus == sel->pc_bus && dev == sel->pc_dev && + func == sel->pc_func) break; } if (pd == LIST_END(&pci->sc_devs)) return ENXIO; + tag = pci_make_tag(pc, sel->pc_bus, sel->pc_dev, sel->pc_func); + switch (cmd) { case PCIOCREAD: io = (struct pci_io *)data; -- 2.20.1