Skip to content

Commit

Permalink
Merge tag 'pci-v4.0-fixes-2' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/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
  • Loading branch information
Linus Torvalds committed Mar 12, 2015
2 parents d3dd73f + 085a68d commit 91e9134
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/pci/host/pci-xgene.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
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)
{
struct xgene_pcie_port *port = bus->sysdata;
Expand All @@ -137,7 +137,7 @@ static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
return NULL;

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 = {
Expand Down
5 changes: 3 additions & 2 deletions drivers/pci/pci-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ static ssize_t driver_override_store(struct device *dev,
struct pci_dev *pdev = to_pci_dev(dev);
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;

driver_override = kstrndup(buf, count, GFP_KERNEL);
Expand Down Expand Up @@ -549,7 +550,7 @@ static ssize_t driver_override_show(struct device *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);

Expand Down

0 comments on commit 91e9134

Please sign in to comment.