Skip to contentSkip to conversation

PCI/VPD: Treat tag 0xff as indicator for missing VPD EPROM

PATCH Applied Heiner Kallweit 2 participants 2 messages Jul 15, 2021 – Aug 2, 2021 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI/VPD: Treat tag 0xff as indicator for missing VPD EPROM

First tag being read as 0xff indicates a missing VPD EPROM, same as 0x00. The latter case we handle properly already, so let's handle 0x00 here too.

---
 drivers/pci/vpd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/vpd.c +2 -2
index 26bf7c877..6a32d938d 100644
@@ -78,8 +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");
+		if ((!header[0] || header[0] == 0xff) && !off) {
+			pci_info(dev, "Invalid VPD tag 00/FF, assume missing optional VPD EPROM\n");
 			return 0;
 		}
 
Signature · 1 line
2.32.0
#1 lore raw
Quoted 4 lines · Heiner Kallweit

First tag being read as 0xff indicates a missing VPD EPROM, same as 0x00. The latter case we handle properly already, so let's handle 0x00 here too.

Applied to pci/vpd for v5.15 with small tweak so the error message can be shared with other errors, thanks!

Quoted 22 lines
---
 drivers/pci/vpd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/vpd.c +2 -2
index 26bf7c877..6a32d938d 100644
@@ -78,8 +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");
+		if ((!header[0] || header[0] == 0xff) && !off) {
+			pci_info(dev, "Invalid VPD tag 00/FF, assume missing optional VPD EPROM\n");
 			return 0;
 		}
 
Signature · 1 line
2.32.0