Commit af649194 authored by Bjorn Helgaas's avatar Bjorn Helgaas

Merge branch 'pci/controller/kirin'

- Fix potential buffer overflow in kirin_pcie_parse_port() (Alexandra
  Diupina)

* pci/controller/kirin:
  PCI: kirin: Fix buffer overflow in kirin_pcie_parse_port()
parents e5f8d1c7 c500a866
...@@ -420,11 +420,11 @@ static int kirin_pcie_parse_port(struct kirin_pcie *pcie, ...@@ -420,11 +420,11 @@ static int kirin_pcie_parse_port(struct kirin_pcie *pcie,
"unable to get a valid reset gpio\n"); "unable to get a valid reset gpio\n");
} }
pcie->num_slots++; if (pcie->num_slots + 1 >= MAX_PCI_SLOTS) {
if (pcie->num_slots > MAX_PCI_SLOTS) {
dev_err(dev, "Too many PCI slots!\n"); dev_err(dev, "Too many PCI slots!\n");
return -EINVAL; return -EINVAL;
} }
pcie->num_slots++;
ret = of_pci_get_devfn(child); ret = of_pci_get_devfn(child);
if (ret < 0) { if (ret < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment