This patch fixes a long standing bug in the PCI sysfs code, where if we were exposing a shadow copy of the ROM (at 0xc0000-0xc0000+128k) we wouldn't properly set the size. Any comments? Another approach would be to mess with pdev->resource[PCI_ROM_RESOURCE] when we do the shadow fixup, but I haven't looked to see if that would have bad implications elsewhere. Thanks, -- Jesse Barnes, Intel Open Source Technology Center diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 9c71858..c23ae27 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -720,6 +720,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) { struct bin_attribute *attr = NULL; int retval; + int rom_size = 0; if (!sysfs_initialized) return -EACCES; @@ -755,12 +756,16 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) goto err_vpd_file; /* If the device has a ROM, try to expose it in sysfs. */ - if (pci_resource_len(pdev, PCI_ROM_RESOURCE) || - (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW)) { + if (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW) + rom_size = 0x20000; + else if (pci_resource_len(pdev, PCI_ROM_RESOURCE)) + rom_size = pci_resource_len(pdev, PCI_ROM_RESOURCE); + + if (rom_size) { attr = kzalloc(sizeof(*attr), GFP_ATOMIC); if (attr) { pdev->rom_attr = attr; - attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE); + attr->size = rom_size; attr->attr.name = "rom"; attr->attr.mode = S_IRUSR; attr->read = pci_read_rom; -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html