mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:44:45 +01:00
Merge branch 'pci/controller/cadence'
- Fix cdns_pcie_host_dma_ranges_cmp() to prevent possible invalid sort order (Ian Rogers) * pci/controller/cadence: PCI: cadence: Avoid signed 64-bit truncation and invalid sort
This commit is contained in:
commit
9a82173951
1 changed files with 11 additions and 1 deletions
|
|
@ -173,11 +173,21 @@ int cdns_pcie_host_dma_ranges_cmp(void *priv, const struct list_head *a,
|
|||
const struct list_head *b)
|
||||
{
|
||||
struct resource_entry *entry1, *entry2;
|
||||
u64 size1, size2;
|
||||
|
||||
entry1 = container_of(a, struct resource_entry, node);
|
||||
entry2 = container_of(b, struct resource_entry, node);
|
||||
|
||||
return resource_size(entry2->res) - resource_size(entry1->res);
|
||||
size1 = resource_size(entry1->res);
|
||||
size2 = resource_size(entry2->res);
|
||||
|
||||
if (size1 > size2)
|
||||
return -1;
|
||||
|
||||
if (size1 < size2)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cdns_pcie_host_dma_ranges_cmp);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue