lkml.org 
[lkml]   [2022]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH Fix 2/2] test_maple_tree: Add test for spanning store of entire range.
Date
Entire range store over an existing tree would cause an underflow in
mas_spanning_store() when the tree is multiple levels. Add a testcase
to ensure it doesn't happen again.

Fixes: 51282228cdd4 (lib/test_maple_tree: add testing for maple tree)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
lib/test_maple_tree.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c
index 9fc0618f4ae7..8de5705b7b9b 100644
--- a/lib/test_maple_tree.c
+++ b/lib/test_maple_tree.c
@@ -35676,6 +35676,19 @@ static noinline void check_spanning_write(struct maple_tree *mt)
mtree_unlock(mt);
mtree_destroy(mt);

+ for (i = 1; i <= max; i++)
+ mtree_test_store_range(mt, i * 10, i * 10 + 5, &i);
+
+ mtree_lock(mt);
+ mas_set_range(&mas, 9, 50006); /* Will expand to 0 - ULONG_MAX */
+ mas_store_gfp(&mas, NULL, GFP_KERNEL);
+ mas_set(&mas, 1205);
+ MT_BUG_ON(mt, mas_walk(&mas) != NULL);
+ mtree_unlock(mt);
+ mt_dump(mt);
+ mt_validate(mt);
+ mtree_destroy(mt);
+
/* Test spanning store that requires a right cousin rebalance */
mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE);
for (i = 0; i <= max; i++)
--
2.35.1
\
 
 \ /
  Last update: 2022-06-25 02:40    [W:0.053 / U:23.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site