From 0f3898a44ad32bec37543a03ed8021f5c880e3c1 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Sun, 19 Aug 2018 12:48:07 -0700 Subject: [PATCH] Fix device_class calculatoin for non-root FreeBSD users libpci uses PCIOCGETCONF for non-privileged access to /dev/pci and calculates device_class value based on pc_class/pc_subclass fields expecting the former to be higher 8 bits of the target value. 0f3d0ca73ecedaba180bf4607bb57fb8abe6d405 errorneously swapped order of class/subclass during calculations. Signed-off-by: Oleksandr Tymoshenko --- lib/fbsd-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fbsd-device.c b/lib/fbsd-device.c index 8d1ec11..6bb5fdd 100644 --- a/lib/fbsd-device.c +++ b/lib/fbsd-device.c @@ -207,7 +207,7 @@ fbsd_fill_info(struct pci_dev *d, int flags) } if (flags & PCI_FILL_CLASS) { - d->device_class = match.pc_class | (match.pc_subclass << 8); + d->device_class = (match.pc_class << 8) | match.pc_subclass; } if (flags & (PCI_FILL_BASES | PCI_FILL_SIZES)) { -- 2.39.2