X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Ffilter.c;h=0301f49f93ff76e6a29f6d781817c2dfd4f83886;hb=e5d1d2dbb64cafd33f9b012b7959b61319dcd250;hp=d025a96c8809ed4d894fc37b554d9a05ae7af7ac;hpb=9423a811ab7324cdee22208d95079e8a59f266fb;p=pciutils.git diff --git a/lib/filter.c b/lib/filter.c index d025a96..0301f49 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -3,7 +3,9 @@ * * Copyright (c) 1998--2022 Martin Mares * - * Can be freely distributed and used under the terms of the GNU GPL. + * Can be freely distributed and used under the terms of the GNU GPL v2+. + * + * SPDX-License-Identifier: GPL-2.0-or-later */ #include @@ -76,6 +78,11 @@ parse_hex_field(char *str, int *outp, unsigned int *maskp, unsigned int max) if (!field_defined(str)) return 1; // and keep the defaults + // Historically, filters allowed writing hexadecimal numbers with leading "0x". + // This was never intentional nor documented, but some people relied on it. + if (!maskp && str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) + str += 2; + while (*str) { int c = *str++; @@ -204,13 +211,13 @@ pci_filter_match_v38(struct pci_filter *f, struct pci_dev *d) } if (f->device_class >= 0) { - pci_fill_info(d, PCI_FILL_CLASS); + pci_fill_info_v38(d, PCI_FILL_CLASS); if ((f->device_class ^ d->device_class) & f->device_class_mask) return 0; } if (f->prog_if >= 0) { - pci_fill_info(d, PCI_FILL_CLASS_EXT); + pci_fill_info_v38(d, PCI_FILL_CLASS_EXT); if (f->prog_if != d->prog_if) return 0; }