From aac918ed55de9d19b4952335ca167ee05e849f68 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Tue, 24 Nov 2020 22:37:08 -0500 Subject: [PATCH] maple_tree: mas_node_walk() could never return false Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 6ed0e70f2326e..39cf6bf187970 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1718,7 +1718,7 @@ static inline unsigned char mas_store_b_node(struct ma_state *mas, return b_end; } -static inline bool mas_node_walk(struct ma_state *mas, enum maple_type type, +static inline void mas_node_walk(struct ma_state *mas, enum maple_type type, unsigned long *range_min, unsigned long *range_max); /* @@ -1963,11 +1963,11 @@ mast_ascend_free(struct maple_subtree_state *mast) /* The node may not contain the value so set slot to ensure all * of the nodes contents are freed or destroyed. */ - if (!mas_node_walk(mast->orig_r, - mte_node_type(mast->orig_r->node), - &range_min, &range_max)) { + if (mast->orig_r->max < mast->orig_r->last) mast->orig_r->offset = mas_data_end(mast->orig_r) + 1; - } + else + mas_node_walk(mast->orig_r, mte_node_type(mast->orig_r->node), + &range_min, &range_max); /* Set up the left side of things */ mast->orig_l->offset = 0; mast->orig_l->index = mast->l->min; @@ -2934,7 +2934,7 @@ bool mas_is_span_wr(struct ma_state *mas, unsigned long piv, return true; } -static inline bool mas_node_walk(struct ma_state *mas, enum maple_type type, +static inline void mas_node_walk(struct ma_state *mas, enum maple_type type, unsigned long *range_min, unsigned long *range_max) { unsigned long *pivots = ma_pivots(mas_mn(mas), type); @@ -2967,7 +2967,6 @@ static inline bool mas_node_walk(struct ma_state *mas, enum maple_type type, dense: *range_min = min; *range_max = pivot; - return true; } /* @@ -3074,9 +3073,7 @@ static inline bool __mas_walk(struct ma_state *mas, unsigned long *range_min, mas->depth++; type = mte_node_type(mas->node); - if (unlikely(!mas_node_walk(mas, type, range_min, range_max))) - return false; - + mas_node_walk(mas, type, range_min, range_max); if (ma_is_leaf(type)) // Leaf. return true; -- 2.50.1