maple_tree: Fix mast_split_data() issue with right node
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 12 Oct 2021 13:32:41 +0000 (09:32 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 20 Oct 2021 19:23:10 +0000 (15:23 -0400)
Don't overwrite the maximum of the right node as it could be the most
right node and be ULONG_MAX with a NULL.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index 9275c26c349012c45fe91ffa33f379d4a3ca3a32..55c6bc67ddebd951b81acee853e2308b1c24a7b4 100644 (file)
@@ -3109,7 +3109,7 @@ static inline void mast_split_data(struct maple_subtree_state *mast,
 
        mab_mas_cp(mast->bn, 0, split, mast->l, true);
        mte_set_pivot(mast->r->node, 0, mast->r->max);
-       mab_mas_cp(mast->bn, split + 1, mast->bn->b_end, mast->r, true);
+       mab_mas_cp(mast->bn, split + 1, mast->bn->b_end, mast->r, false);
        mast->l->offset = mte_parent_slot(mas->node);
        mast->l->max = mast->bn->pivot[split];
        mast->r->min = mast->l->max + 1;