diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-31 12:25:58 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-31 12:25:58 -0700 |
commit | bb3540be73ca1e483aa977d859960895fe85372d (patch) | |
tree | 88edcf2b262bdb38917c25ba2665a69b4767ea5a | |
parent | 67ff377bc30cd4eb91f0454adb9dcb1f4de280f2 (diff) | |
parent | 48ab6d5d1f096d6fac5b59f94af0aa394115a001 (diff) | |
download | lwn-bb3540be73ca1e483aa977d859960895fe85372d.tar.gz lwn-bb3540be73ca1e483aa977d859960895fe85372d.zip |
Merge tag 'dma-mapping-5.10-2' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping fix from Christoph Hellwig:
"Fix an integer overflow on 32-bit platforms in the new DMA range code
(Geert Uytterhoeven)"
* tag 'dma-mapping-5.10-2' of git://git.infradead.org/users/hch/dma-mapping:
dma-mapping: fix 32-bit overflow with CONFIG_ARM_LPAE=n
-rw-r--r-- | drivers/of/device.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c index 655dee422563..3a469c79e6b0 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -93,7 +93,7 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, { const struct iommu_ops *iommu; const struct bus_dma_region *map = NULL; - dma_addr_t dma_start = 0; + u64 dma_start = 0; u64 mask, end, size = 0; bool coherent; int ret; @@ -109,10 +109,10 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, return ret == -ENODEV ? 0 : ret; } else { const struct bus_dma_region *r = map; - dma_addr_t dma_end = 0; + u64 dma_end = 0; /* Determine the overall bounds of all DMA regions */ - for (dma_start = ~(dma_addr_t)0; r->size; r++) { + for (dma_start = ~0ULL; r->size; r++) { /* Take lower and upper limits */ if (r->dma_start < dma_start) dma_start = r->dma_start; |