]> git.ipfire.org Git - thirdparty/libvirt.git/commit
PCI VPD: Skip fields with invalid values
authorDmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
Fri, 29 Oct 2021 18:57:17 +0000 (21:57 +0300)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 2 Nov 2021 13:43:23 +0000 (13:43 +0000)
commit600f580d623ae4077ddeb6c7cb24f8a315a7c73b
tree10e4a4b8666042473a952c748bf491ac2a077f94
parent43820e4b8037680ec451761216750c6b139db67a
PCI VPD: Skip fields with invalid values

While invalid values need to be ignored when presenting VPD data to the
user, it would be good to attempt to parse a valid portion of the VPD
instead of marking it invalid as a whole.

Based on a mailing list discussion, the set of accepted characters is
extended to the set of printable ASCII characters.

https://listman.redhat.com/archives/libvir-list/2021-October/msg01043.html

The particular example encountered on real hardware was multi-faceted:

* "N/A" strings present in read-only fields. This would not be a useful
  valid value for a field (especially if a unique serial number is
  expected), however, it was decided to delegate handling of those kinds
  of values to higher-level software;
* "4W/1W PCIeG2x4" - looks like some vendors use even more printable
  characters in the ASCII range than we currently allow. Since the
  PCI/PCIe VPD specs mention alphanumeric characters without specifying
  the full character set, it looks like this is ambiguous for vendors
  and they tend to use printable ASCII characters;
* 0xFF bytes present in VPD-W field values. Those bytes do not map to
  printable ASCII code points and were probably used by the vendor as
  placeholders. Ignoring the whole VPD because of that would be too
  strict.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
src/util/virpcivpd.c
tests/virpcivpdtest.c