diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dma-debug.c | 10 | ||||
| -rw-r--r-- | lib/idr.c | 13 |
2 files changed, 12 insertions, 11 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 1b34d210452c..7f5cdc1e6b29 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
| @@ -1491,12 +1491,12 @@ void debug_dma_alloc_coherent(struct device *dev, size_t size, | |||
| 1491 | if (unlikely(virt == NULL)) | 1491 | if (unlikely(virt == NULL)) |
| 1492 | return; | 1492 | return; |
| 1493 | 1493 | ||
| 1494 | entry = dma_entry_alloc(); | 1494 | /* handle vmalloc and linear addresses */ |
| 1495 | if (!entry) | 1495 | if (!is_vmalloc_addr(virt) && !virt_addr_valid(virt)) |
| 1496 | return; | 1496 | return; |
| 1497 | 1497 | ||
| 1498 | /* handle vmalloc and linear addresses */ | 1498 | entry = dma_entry_alloc(); |
| 1499 | if (!is_vmalloc_addr(virt) && !virt_to_page(virt)) | 1499 | if (!entry) |
| 1500 | return; | 1500 | return; |
| 1501 | 1501 | ||
| 1502 | entry->type = dma_debug_coherent; | 1502 | entry->type = dma_debug_coherent; |
| @@ -1528,7 +1528,7 @@ void debug_dma_free_coherent(struct device *dev, size_t size, | |||
| 1528 | }; | 1528 | }; |
| 1529 | 1529 | ||
| 1530 | /* handle vmalloc and linear addresses */ | 1530 | /* handle vmalloc and linear addresses */ |
| 1531 | if (!is_vmalloc_addr(virt) && !virt_to_page(virt)) | 1531 | if (!is_vmalloc_addr(virt) && !virt_addr_valid(virt)) |
| 1532 | return; | 1532 | return; |
| 1533 | 1533 | ||
| 1534 | if (is_vmalloc_addr(virt)) | 1534 | if (is_vmalloc_addr(virt)) |
| @@ -36,8 +36,8 @@ int idr_alloc_u32(struct idr *idr, void *ptr, u32 *nextid, | |||
| 36 | { | 36 | { |
| 37 | struct radix_tree_iter iter; | 37 | struct radix_tree_iter iter; |
| 38 | void __rcu **slot; | 38 | void __rcu **slot; |
| 39 | int base = idr->idr_base; | 39 | unsigned int base = idr->idr_base; |
| 40 | int id = *nextid; | 40 | unsigned int id = *nextid; |
| 41 | 41 | ||
| 42 | if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr))) | 42 | if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr))) |
| 43 | return -EINVAL; | 43 | return -EINVAL; |
| @@ -204,10 +204,11 @@ int idr_for_each(const struct idr *idr, | |||
| 204 | 204 | ||
| 205 | radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, 0) { | 205 | radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, 0) { |
| 206 | int ret; | 206 | int ret; |
| 207 | unsigned long id = iter.index + base; | ||
| 207 | 208 | ||
| 208 | if (WARN_ON_ONCE(iter.index > INT_MAX)) | 209 | if (WARN_ON_ONCE(id > INT_MAX)) |
| 209 | break; | 210 | break; |
| 210 | ret = fn(iter.index + base, rcu_dereference_raw(*slot), data); | 211 | ret = fn(id, rcu_dereference_raw(*slot), data); |
| 211 | if (ret) | 212 | if (ret) |
| 212 | return ret; | 213 | return ret; |
| 213 | } | 214 | } |
| @@ -230,8 +231,8 @@ void *idr_get_next(struct idr *idr, int *nextid) | |||
| 230 | { | 231 | { |
| 231 | struct radix_tree_iter iter; | 232 | struct radix_tree_iter iter; |
| 232 | void __rcu **slot; | 233 | void __rcu **slot; |
| 233 | int base = idr->idr_base; | 234 | unsigned long base = idr->idr_base; |
| 234 | int id = *nextid; | 235 | unsigned long id = *nextid; |
| 235 | 236 | ||
| 236 | id = (id < base) ? 0 : id - base; | 237 | id = (id < base) ? 0 : id - base; |
| 237 | slot = radix_tree_iter_find(&idr->idr_rt, &iter, id); | 238 | slot = radix_tree_iter_find(&idr->idr_rt, &iter, id); |
