aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/vpd.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2021-07-29 12:22:25 -0500
committerBjorn Helgaas <bhelgaas@google.com>2021-07-30 13:41:52 -0500
commit4e0d77f8e831fcbe86a02dd0ead12d9c8c057700 (patch)
tree27d50b6ec2cf4f56fc56ec6515dc56035359f7c4 /drivers/pci/vpd.c
parentPCI/VPD: Check Resource Item Names against those valid for type (diff)
downloadlinux-dev-4e0d77f8e831fcbe86a02dd0ead12d9c8c057700.tar.xz
linux-dev-4e0d77f8e831fcbe86a02dd0ead12d9c8c057700.zip
PCI/VPD: Treat initial 0xff as missing EEPROM
Previously we assumed that the first tag being 0x00 meant an EEPROM was missing. The first tag being 0xff means the same thing; check for that also. [bhelgaas: rework error mesage] Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers/pci/vpd.c')
-rw-r--r--drivers/pci/vpd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c
index 28052d4d1990..05e4df0a84d3 100644
--- a/drivers/pci/vpd.c
+++ b/drivers/pci/vpd.c
@@ -78,10 +78,8 @@ static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size)
while (off < old_size && pci_read_vpd(dev, off, 1, header) == 1) {
unsigned char tag;
- if (!header[0] && !off) {
- pci_info(dev, "Invalid VPD tag 00, assume missing optional VPD EPROM\n");
- return 0;
- }
+ if (off == 0 && (header[0] == 0x00 || header[0] == 0xff))
+ goto error;
if (header[0] & PCI_VPD_LRDT) {
/* Large Resource Data Type Tag */
@@ -113,6 +111,12 @@ static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size)
}
}
return 0;
+
+error:
+ pci_info(dev, "invalid VPD tag %#04x at offset %zu%s\n",
+ header[0], off, off == 0 ?
+ "; assume missing optional EEPROM" : "");
+ return 0;
}
/*