diff --git a/lib/maple_tree.c b/lib/maple_tree.c index fe3947b80069..26e2045d3cda 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2994,7 +2994,9 @@ static int mas_spanning_rebalance(struct ma_state *mas, mast->free = &free; mast->destroy = &destroy; l_mas.node = r_mas.node = m_mas.node = MAS_NONE; - if (!(mast->orig_l->min && mast->orig_r->max == ULONG_MAX) && + + /* Check if this is not root and has sufficient data. */ + if (((mast->orig_l->min != 0) || (mast->orig_r->max != ULONG_MAX)) && unlikely(mast->bn->b_end <= mt_min_slots[mast->bn->type])) mast_spanning_rebalance(mast);