提交 91e9134e 编写于 作者: L Linus Torvalds

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
...@@ -127,7 +127,7 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset) ...@@ -127,7 +127,7 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
return false; return false;
} }
static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
int offset) int offset)
{ {
struct xgene_pcie_port *port = bus->sysdata; struct xgene_pcie_port *port = bus->sysdata;
...@@ -137,7 +137,7 @@ static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, ...@@ -137,7 +137,7 @@ static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
return NULL; return NULL;
xgene_pcie_set_rtdid_reg(bus, devfn); xgene_pcie_set_rtdid_reg(bus, devfn);
return xgene_pcie_get_cfg_base(bus); return xgene_pcie_get_cfg_base(bus) + offset;
} }
static struct pci_ops xgene_pcie_ops = { static struct pci_ops xgene_pcie_ops = {
......
...@@ -521,7 +521,8 @@ static ssize_t driver_override_store(struct device *dev, ...@@ -521,7 +521,8 @@ static ssize_t driver_override_store(struct device *dev,
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
char *driver_override, *old = pdev->driver_override, *cp; char *driver_override, *old = pdev->driver_override, *cp;
if (count > PATH_MAX) /* We need to keep extra room for a newline */
if (count >= (PAGE_SIZE - 1))
return -EINVAL; return -EINVAL;
driver_override = kstrndup(buf, count, GFP_KERNEL); driver_override = kstrndup(buf, count, GFP_KERNEL);
...@@ -549,7 +550,7 @@ static ssize_t driver_override_show(struct device *dev, ...@@ -549,7 +550,7 @@ static ssize_t driver_override_show(struct device *dev,
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
return sprintf(buf, "%s\n", pdev->driver_override); return snprintf(buf, PAGE_SIZE, "%s\n", pdev->driver_override);
} }
static DEVICE_ATTR_RW(driver_override); static DEVICE_ATTR_RW(driver_override);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册