|
@@ -96,6 +96,9 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
|
|
|
last_image = readb(pds + 21) & 0x80;
|
|
last_image = readb(pds + 21) & 0x80;
|
|
|
length = readw(pds + 16);
|
|
length = readw(pds + 16);
|
|
|
image += length * 512;
|
|
image += length * 512;
|
|
|
|
|
+ /* Avoid iterating through memory outside the resource window */
|
|
|
|
|
+ if (image > rom + size)
|
|
|
|
|
+ break;
|
|
|
} while (length && !last_image);
|
|
} while (length && !last_image);
|
|
|
|
|
|
|
|
/* never return a size larger than the PCI resource window */
|
|
/* never return a size larger than the PCI resource window */
|