Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pci-v4.0-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI fixes from Bjorn Helgaas:
"Here are a couple updates for v4.0.

One fixes a config accessor problem on APM X-Gene that we introduced
when switching to generic config accessors, and the other fixes an
older read-past-end-of-buffer problem in sysfs.

APM X-Gene host bridge driver
- Add register offset to config space base address (Feng Kan)

Miscellaneous
- Don't read past the end of sysfs "driver_override" buffer (Sasha Levin)"

* tag 'pci-v4.0-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
PCI: xgene: Add register offset to config space base address
PCI: Don't read past the end of sysfs "driver_override" buffer

+5 -4
+2 -2
drivers/pci/host/pci-xgene.c
··· 127 127 return false; 128 128 } 129 129 130 - static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, 130 + static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, 131 131 int offset) 132 132 { 133 133 struct xgene_pcie_port *port = bus->sysdata; ··· 137 137 return NULL; 138 138 139 139 xgene_pcie_set_rtdid_reg(bus, devfn); 140 - return xgene_pcie_get_cfg_base(bus); 140 + return xgene_pcie_get_cfg_base(bus) + offset; 141 141 } 142 142 143 143 static struct pci_ops xgene_pcie_ops = {
+3 -2
drivers/pci/pci-sysfs.c
··· 521 521 struct pci_dev *pdev = to_pci_dev(dev); 522 522 char *driver_override, *old = pdev->driver_override, *cp; 523 523 524 - if (count > PATH_MAX) 524 + /* We need to keep extra room for a newline */ 525 + if (count >= (PAGE_SIZE - 1)) 525 526 return -EINVAL; 526 527 527 528 driver_override = kstrndup(buf, count, GFP_KERNEL); ··· 550 549 { 551 550 struct pci_dev *pdev = to_pci_dev(dev); 552 551 553 - return sprintf(buf, "%s\n", pdev->driver_override); 552 + return snprintf(buf, PAGE_SIZE, "%s\n", pdev->driver_override); 554 553 } 555 554 static DEVICE_ATTR_RW(driver_override); 556 555