Skip to content

Commit 7a93c71

Browse files
howlettakpm00
authored andcommitted
maple_tree: fix 32 bit mas_next testing
The test setup of mas_next is dependent on node entry size to create a 2 level tree, but the tests did not account for this in the expected value when shifting beyond the scope of the tree. Fix this by setting up the test to succeed depending on the node entries which is dependent on the 32/64 bit setup. Link: https://lkml.kernel.org/r/[email protected] Fixes: 120b116 ("maple_tree: reorganize testing to restore module testing") Signed-off-by: Liam R. Howlett <[email protected]> Reported-by: Geert Uytterhoeven <[email protected]> Closes: https://lore.kernel.org/linux-mm/CAMuHMdV4T53fOw7VPoBgPR7fP6RYqf=CBhD_y_vOg53zZX_DnA@mail.gmail.com/ Tested-by: Geert Uytterhoeven <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 25b5949 commit 7a93c71

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/test_maple_tree.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1898,13 +1898,16 @@ static noinline void __init next_prev_test(struct maple_tree *mt)
18981898
725};
18991899
static const unsigned long level2_32[] = { 1747, 2000, 1750, 1755,
19001900
1760, 1765};
1901+
unsigned long last_index;
19011902

19021903
if (MAPLE_32BIT) {
19031904
nr_entries = 500;
19041905
level2 = level2_32;
1906+
last_index = 0x138e;
19051907
} else {
19061908
nr_entries = 200;
19071909
level2 = level2_64;
1910+
last_index = 0x7d6;
19081911
}
19091912

19101913
for (i = 0; i <= nr_entries; i++)
@@ -2011,7 +2014,7 @@ static noinline void __init next_prev_test(struct maple_tree *mt)
20112014

20122015
val = mas_next(&mas, ULONG_MAX);
20132016
MT_BUG_ON(mt, val != NULL);
2014-
MT_BUG_ON(mt, mas.index != 0x7d6);
2017+
MT_BUG_ON(mt, mas.index != last_index);
20152018
MT_BUG_ON(mt, mas.last != ULONG_MAX);
20162019

20172020
val = mas_prev(&mas, 0);

0 commit comments

Comments
 (0)