aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/rom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/rom.c')
-rw-r--r--drivers/pci/rom.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 838575e3fac6..713c78f3a65d 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -125,7 +125,9 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
125 image += readw(pds + 16) * 512; 125 image += readw(pds + 16) * 512;
126 } while (!last_image); 126 } while (!last_image);
127 127
128 *size = image - rom; 128 /* never return a size larger than the PCI resource window */
129 /* there are known ROMs that get the size wrong */
130 *size = min((size_t)(image - rom), *size);
129 131
130 return rom; 132 return rom;
131} 133}