]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
Fix device_class calculatoin for non-root FreeBSD users
authorOleksandr Tymoshenko <gonzo@bluezbox.com>
Sun, 19 Aug 2018 19:48:07 +0000 (12:48 -0700)
committerMartin Mares <mj@ucw.cz>
Tue, 16 Oct 2018 16:23:47 +0000 (18:23 +0200)
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 <gonzo@bluezbox.com>
lib/fbsd-device.c

index 8d1ec119327614d19a7be2e2947e2bca5ae81ed0..6bb5fddedf2c6f4a9cb7f0b76ec4903668ed5315 100644 (file)
@@ -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))
     {