From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Lukas Wunner <lukas@wunner.de>,
Chris Chiu <chris.chiu@canonical.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-pci@vger.kernel.org
Subject: [PATCH 1/6] PCI: Fix used_buses calculation in pci_scan_child_bus_extend()
Date: Tue, 16 Aug 2022 13:07:35 +0300 [thread overview]
Message-ID: <20220816100740.68667-2-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20220816100740.68667-1-mika.westerberg@linux.intel.com>
The 'cmax' and 'max' are in wrong order and that might cause the
used_buses to become negative in certain cases. It should be the same as
we do in the block following this one. Fix this.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216000
Fixes: 3374c545c27c ("PCI: Account for all bridges on bus when distributing bus numbers")
Reported-by: Chris Chiu <chris.chiu@canonical.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/pci/probe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index c5286b027f00..4f940dcd102c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2920,8 +2920,8 @@ static unsigned int pci_scan_child_bus_extend(struct pci_bus *bus,
* hotplug bridges too much during the second scan below.
*/
used_buses++;
- if (cmax - max > 1)
- used_buses += cmax - max - 1;
+ if (max - cmax > 1)
+ used_buses += max - cmax - 1;
}
/* Scan bridges that need to be reconfigured */
--
2.35.1
next prev parent reply other threads:[~2022-08-16 10:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 10:07 [PATCH 0/6] PCI: Allow for future resource expansion on initial root bus scan Mika Westerberg
2022-08-16 10:07 ` Mika Westerberg [this message]
2022-08-16 10:07 ` [PATCH 2/6] PCI: Pass available buses also when the bridge is already configured Mika Westerberg
2022-08-16 10:07 ` [PATCH 3/6] PCI: Distribute available resources for root buses too Mika Westerberg
2022-08-31 14:18 ` Andy Shevchenko
2022-08-16 10:07 ` [PATCH 4/6] PCI: Remove two unnecessary empty lines in pci_scan_child_bus_extend() Mika Westerberg
2022-08-16 10:07 ` [PATCH 5/6] PCI: Fix typo " Mika Westerberg
2022-08-16 10:07 ` [PATCH 6/6] PCI: Fix indentation in pci_bridge_distribute_available_resources() Mika Westerberg
2022-08-31 14:19 ` Andy Shevchenko
2022-08-17 1:51 ` [PATCH 0/6] PCI: Allow for future resource expansion on initial root bus scan Chris Chiu
2022-08-31 14:20 ` Andy Shevchenko
2022-09-01 5:31 ` Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220816100740.68667-2-mika.westerberg@linux.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=chris.chiu@canonical.com \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=rafael.j.wysocki@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).