aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/radix-tree/main.c
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2018-05-19 16:30:54 -0400
committerMatthew Wilcox <willy@infradead.org>2018-08-21 23:31:20 -0400
commitd1c0d5e3c63d61226a75f24d5c35fe20755f0180 (patch)
treee29ecd34507fc26355626633e4d433955a67643b /tools/testing/radix-tree/main.c
parentradix tree test suite: Fix compilation (diff)
downloadlinux-dev-d1c0d5e3c63d61226a75f24d5c35fe20755f0180.tar.xz
linux-dev-d1c0d5e3c63d61226a75f24d5c35fe20755f0180.zip
radix tree test suite: Enable ubsan
Add support for the undefined behaviour sanitizer and fix the bugs that ubsan pointed out. Nothing major, and all in the test suite, not the code. Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to '')
-rw-r--r--tools/testing/radix-tree/main.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/testing/radix-tree/main.c b/tools/testing/radix-tree/main.c
index 257f3f8aacaa..584a8732f5ce 100644
--- a/tools/testing/radix-tree/main.c
+++ b/tools/testing/radix-tree/main.c
@@ -27,20 +27,22 @@ void __gang_check(unsigned long middle, long down, long up, int chunk, int hop)
item_check_present(&tree, middle + idx);
item_check_absent(&tree, middle + up);
- item_gang_check_present(&tree, middle - down,
- up + down, chunk, hop);
- item_full_scan(&tree, middle - down, down + up, chunk);
+ if (chunk > 0) {
+ item_gang_check_present(&tree, middle - down, up + down,
+ chunk, hop);
+ item_full_scan(&tree, middle - down, down + up, chunk);
+ }
item_kill_tree(&tree);
}
void gang_check(void)
{
- __gang_check(1 << 30, 128, 128, 35, 2);
- __gang_check(1 << 31, 128, 128, 32, 32);
- __gang_check(1 << 31, 128, 128, 32, 100);
- __gang_check(1 << 31, 128, 128, 17, 7);
- __gang_check(0xffff0000, 0, 65536, 17, 7);
- __gang_check(0xfffffffe, 1, 1, 17, 7);
+ __gang_check(1UL << 30, 128, 128, 35, 2);
+ __gang_check(1UL << 31, 128, 128, 32, 32);
+ __gang_check(1UL << 31, 128, 128, 32, 100);
+ __gang_check(1UL << 31, 128, 128, 17, 7);
+ __gang_check(0xffff0000UL, 0, 65536, 17, 7);
+ __gang_check(0xfffffffeUL, 1, 1, 17, 7);
}
void __big_gang_check(void)