diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Kconfig.debug | 1 | ||||
| -rw-r--r-- | lib/bug.c | 4 | ||||
| -rw-r--r-- | lib/dma-debug.c | 10 | ||||
| -rw-r--r-- | lib/dma-direct.c | 5 | ||||
| -rw-r--r-- | lib/idr.c | 15 | ||||
| -rw-r--r-- | lib/radix-tree.c | 2 | ||||
| -rw-r--r-- | lib/test_bpf.c | 4 | ||||
| -rw-r--r-- | lib/test_kmod.c | 2 | ||||
| -rw-r--r-- | lib/vsprintf.c | 2 |
9 files changed, 27 insertions, 18 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 6088408ef26c..64155e310a9f 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
| @@ -1642,6 +1642,7 @@ config DMA_API_DEBUG | |||
| 1642 | 1642 | ||
| 1643 | menuconfig RUNTIME_TESTING_MENU | 1643 | menuconfig RUNTIME_TESTING_MENU |
| 1644 | bool "Runtime Testing" | 1644 | bool "Runtime Testing" |
| 1645 | def_bool y | ||
| 1645 | 1646 | ||
| 1646 | if RUNTIME_TESTING_MENU | 1647 | if RUNTIME_TESTING_MENU |
| 1647 | 1648 | ||
| @@ -150,6 +150,8 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) | |||
| 150 | return BUG_TRAP_TYPE_NONE; | 150 | return BUG_TRAP_TYPE_NONE; |
| 151 | 151 | ||
| 152 | bug = find_bug(bugaddr); | 152 | bug = find_bug(bugaddr); |
| 153 | if (!bug) | ||
| 154 | return BUG_TRAP_TYPE_NONE; | ||
| 153 | 155 | ||
| 154 | file = NULL; | 156 | file = NULL; |
| 155 | line = 0; | 157 | line = 0; |
| @@ -191,7 +193,7 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) | |||
| 191 | if (file) | 193 | if (file) |
| 192 | pr_crit("kernel BUG at %s:%u!\n", file, line); | 194 | pr_crit("kernel BUG at %s:%u!\n", file, line); |
| 193 | else | 195 | else |
| 194 | pr_crit("Kernel BUG at %p [verbose debug info unavailable]\n", | 196 | pr_crit("Kernel BUG at %pB [verbose debug info unavailable]\n", |
| 195 | (void *)bugaddr); | 197 | (void *)bugaddr); |
| 196 | 198 | ||
| 197 | return BUG_TRAP_TYPE_BUG; | 199 | return BUG_TRAP_TYPE_BUG; |
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)) |
diff --git a/lib/dma-direct.c b/lib/dma-direct.c index 40b1f92f2214..c9e8e21cb334 100644 --- a/lib/dma-direct.c +++ b/lib/dma-direct.c | |||
| @@ -84,6 +84,10 @@ again: | |||
| 84 | return page_address(page); | 84 | return page_address(page); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | /* | ||
| 88 | * NOTE: this function must never look at the dma_addr argument, because we want | ||
| 89 | * to be able to use it as a helper for iommu implementations as well. | ||
| 90 | */ | ||
| 87 | void dma_direct_free(struct device *dev, size_t size, void *cpu_addr, | 91 | void dma_direct_free(struct device *dev, size_t size, void *cpu_addr, |
| 88 | dma_addr_t dma_addr, unsigned long attrs) | 92 | dma_addr_t dma_addr, unsigned long attrs) |
| 89 | { | 93 | { |
| @@ -152,5 +156,6 @@ const struct dma_map_ops dma_direct_ops = { | |||
| 152 | .map_sg = dma_direct_map_sg, | 156 | .map_sg = dma_direct_map_sg, |
| 153 | .dma_supported = dma_direct_supported, | 157 | .dma_supported = dma_direct_supported, |
| 154 | .mapping_error = dma_direct_mapping_error, | 158 | .mapping_error = dma_direct_mapping_error, |
| 159 | .is_phys = 1, | ||
| 155 | }; | 160 | }; |
| 156 | EXPORT_SYMBOL(dma_direct_ops); | 161 | EXPORT_SYMBOL(dma_direct_ops); |
| @@ -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); |
| @@ -431,7 +432,6 @@ int ida_get_new_above(struct ida *ida, int start, int *id) | |||
| 431 | bitmap = this_cpu_xchg(ida_bitmap, NULL); | 432 | bitmap = this_cpu_xchg(ida_bitmap, NULL); |
| 432 | if (!bitmap) | 433 | if (!bitmap) |
| 433 | return -EAGAIN; | 434 | return -EAGAIN; |
| 434 | memset(bitmap, 0, sizeof(*bitmap)); | ||
| 435 | bitmap->bitmap[0] = tmp >> RADIX_TREE_EXCEPTIONAL_SHIFT; | 435 | bitmap->bitmap[0] = tmp >> RADIX_TREE_EXCEPTIONAL_SHIFT; |
| 436 | rcu_assign_pointer(*slot, bitmap); | 436 | rcu_assign_pointer(*slot, bitmap); |
| 437 | } | 437 | } |
| @@ -464,7 +464,6 @@ int ida_get_new_above(struct ida *ida, int start, int *id) | |||
| 464 | bitmap = this_cpu_xchg(ida_bitmap, NULL); | 464 | bitmap = this_cpu_xchg(ida_bitmap, NULL); |
| 465 | if (!bitmap) | 465 | if (!bitmap) |
| 466 | return -EAGAIN; | 466 | return -EAGAIN; |
| 467 | memset(bitmap, 0, sizeof(*bitmap)); | ||
| 468 | __set_bit(bit, bitmap->bitmap); | 467 | __set_bit(bit, bitmap->bitmap); |
| 469 | radix_tree_iter_replace(root, &iter, slot, bitmap); | 468 | radix_tree_iter_replace(root, &iter, slot, bitmap); |
| 470 | } | 469 | } |
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 0a7ae3288a24..8e00138d593f 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
| @@ -2125,7 +2125,7 @@ int ida_pre_get(struct ida *ida, gfp_t gfp) | |||
| 2125 | preempt_enable(); | 2125 | preempt_enable(); |
| 2126 | 2126 | ||
| 2127 | if (!this_cpu_read(ida_bitmap)) { | 2127 | if (!this_cpu_read(ida_bitmap)) { |
| 2128 | struct ida_bitmap *bitmap = kmalloc(sizeof(*bitmap), gfp); | 2128 | struct ida_bitmap *bitmap = kzalloc(sizeof(*bitmap), gfp); |
| 2129 | if (!bitmap) | 2129 | if (!bitmap) |
| 2130 | return 0; | 2130 | return 0; |
| 2131 | if (this_cpu_cmpxchg(ida_bitmap, NULL, bitmap)) | 2131 | if (this_cpu_cmpxchg(ida_bitmap, NULL, bitmap)) |
diff --git a/lib/test_bpf.c b/lib/test_bpf.c index b4e22345963f..2efb213716fa 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c | |||
| @@ -24,10 +24,11 @@ | |||
| 24 | #include <linux/if_vlan.h> | 24 | #include <linux/if_vlan.h> |
| 25 | #include <linux/random.h> | 25 | #include <linux/random.h> |
| 26 | #include <linux/highmem.h> | 26 | #include <linux/highmem.h> |
| 27 | #include <linux/sched.h> | ||
| 27 | 28 | ||
| 28 | /* General test specific settings */ | 29 | /* General test specific settings */ |
| 29 | #define MAX_SUBTESTS 3 | 30 | #define MAX_SUBTESTS 3 |
| 30 | #define MAX_TESTRUNS 10000 | 31 | #define MAX_TESTRUNS 1000 |
| 31 | #define MAX_DATA 128 | 32 | #define MAX_DATA 128 |
| 32 | #define MAX_INSNS 512 | 33 | #define MAX_INSNS 512 |
| 33 | #define MAX_K 0xffffFFFF | 34 | #define MAX_K 0xffffFFFF |
| @@ -6582,6 +6583,7 @@ static __init int test_bpf(void) | |||
| 6582 | struct bpf_prog *fp; | 6583 | struct bpf_prog *fp; |
| 6583 | int err; | 6584 | int err; |
| 6584 | 6585 | ||
| 6586 | cond_resched(); | ||
| 6585 | if (exclude_test(i)) | 6587 | if (exclude_test(i)) |
| 6586 | continue; | 6588 | continue; |
| 6587 | 6589 | ||
diff --git a/lib/test_kmod.c b/lib/test_kmod.c index e372b97eee13..0e5b7a61460b 100644 --- a/lib/test_kmod.c +++ b/lib/test_kmod.c | |||
| @@ -1141,7 +1141,7 @@ static struct kmod_test_device *register_test_dev_kmod(void) | |||
| 1141 | mutex_lock(®_dev_mutex); | 1141 | mutex_lock(®_dev_mutex); |
| 1142 | 1142 | ||
| 1143 | /* int should suffice for number of devices, test for wrap */ | 1143 | /* int should suffice for number of devices, test for wrap */ |
| 1144 | if (unlikely(num_test_devs + 1) < 0) { | 1144 | if (num_test_devs + 1 == INT_MAX) { |
| 1145 | pr_err("reached limit of number of test devices\n"); | 1145 | pr_err("reached limit of number of test devices\n"); |
| 1146 | goto out; | 1146 | goto out; |
| 1147 | } | 1147 | } |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 77ee6ced11b1..d7a708f82559 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
| @@ -1849,7 +1849,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
| 1849 | { | 1849 | { |
| 1850 | const int default_width = 2 * sizeof(void *); | 1850 | const int default_width = 2 * sizeof(void *); |
| 1851 | 1851 | ||
| 1852 | if (!ptr && *fmt != 'K') { | 1852 | if (!ptr && *fmt != 'K' && *fmt != 'x') { |
| 1853 | /* | 1853 | /* |
| 1854 | * Print (null) with the same width as a pointer so it makes | 1854 | * Print (null) with the same width as a pointer so it makes |
| 1855 | * tabular output look nice. | 1855 | * tabular output look nice. |
