Updated mt_validate() to validate MAPLE_ENODE and ma_nonleaf_data_end(). Signed-off-by: Peng Zhang <zhangpeng.00@xxxxxxxxxxxxx> --- lib/maple_tree.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 98e4fdf6f4b9..e0e9a87bdb43 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -7130,6 +7130,11 @@ static void mas_validate_child_slot(struct ma_state *mas) MT_BUG_ON(mas->tree, 1); } + if (!slot_is_mte((unsigned long)child)) { + pr_err("Slot is not mte %p[%u]\n", mas_mn(mas), i); + MT_BUG_ON(mas->tree, 1); + } + if (mte_parent_slot(child) != i) { pr_err("Slot error at %p[%u]: child %p has pslot %u\n", mas_mn(mas), i, mte_to_node(child), @@ -7200,6 +7205,13 @@ static void mas_validate_limits(struct ma_state *mas) MT_BUG_ON(mas->tree, 1); } + if (!mte_is_leaf(mas->node) && + mas_data_end(mas) != mte_nonleaf_data_end(mas->tree, mas->node)) { + pr_err("node:%p mas_data_end() != mte_nonleaf_data_end()\n", + mas_mn(mas)); + MT_BUG_ON(mas->tree, 1); + } + for (i += 1; i < mt_slots[type]; i++) { void *entry = mas_slot(mas, slots, i); -- 2.20.1