]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] PCI: Adjust PCI rom code to handle more broken ROMs
authorJon Smirl <jonsmirl@gmail.com>
Fri, 29 Jul 2005 19:16:17 +0000 (12:16 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Jul 2005 20:12:51 +0000 (13:12 -0700)
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.

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/pci/rom.c

index 838575e3fac6b7d95a03953e066c46e7c41fc137..713c78f3a65d22950adccf6a5111ecc03a328778 100644 (file)
@@ -125,7 +125,9 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
                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;
 }