mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2026-03-14 21:10:27 +01:00
pci: fix overflow in __pci_hose_bus_to_phys w/ large RAM
If a 32-bit system has 2GB of RAM, and the base address of that RAM is 2GB, then start+size will overflow a 32-bit value (to a value of 0). To avoid such an overflow, convert __pci_hose_bus_to_phys() to calculate the offset of a bus address into a PCI region, rather than comparing a bus address against the end of a PCI region. Signed-off-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
parent
686dca0fc4
commit
d878c9a932
1 changed files with 1 additions and 1 deletions
|
|
@ -323,7 +323,7 @@ int __pci_hose_bus_to_phys(struct pci_controller *hose,
|
|||
continue;
|
||||
|
||||
if (bus_addr >= res->bus_start &&
|
||||
bus_addr < res->bus_start + res->size) {
|
||||
(bus_addr - res->bus_start) < res->size) {
|
||||
*pa = (bus_addr - res->bus_start + res->phys_start);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue