Skip to contentSkip to conversation

PATCH: Adjust PCI rom code to handle more broken ROMs

PATCH Jon Smirl 1 participant 1 message Jul 16, 2005 PCI

lore
Share & tools
lore

Jon Smirl

author
#0 lore raw

There are ROMs reporting that their size exceeds their PCI ROM resource window. This patch returns the minimum of the resource window size or the size in the ROM. An example of this breakage is the XGI Volari Z7.

Patch is in an attachment since gmail will mangle the tabs.

Signature · 2 lines
Jon Smirl
[email protected]
drivers/pci/rom.c +3 -1
@@ -125,7 +125,9 @@ void __iomem *pci_map_rom(struct pci_dev
 		image += readw(pds + 16) * 512;
 	} while (!last_image);
 
-	*size = image - rom;
+	/* never return a size larger than the PCI resource window */
+	/* there are known ROMs that get the size wrong */
+	*size = min((size_t)(image - rom), *size);
 
 	return rom;
 }