]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Remove BUG_ON() from ma_meta_gap()
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 1 Sep 2022 20:29:29 +0000 (16:29 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 13 Dec 2022 21:22:37 +0000 (16:22 -0500)
Replace the in-function call to BUG_ON() with calls before the function
call MT_WARN_ON() to get more information on error conditions and to
avoid crashing - although the crash is imminent in this case.

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

index f7273b30cf23a978d2082f30aca36eff1f5fef62..f2faa9917a3f806dd04c5a93d65772478832f842 100644 (file)
@@ -953,8 +953,6 @@ static inline unsigned char ma_meta_end(struct maple_node *mn,
 static inline unsigned char ma_meta_gap(struct maple_node *mn,
                                        enum maple_type mt)
 {
-       BUG_ON(mt != maple_arange_64);
-
        return mn->ma64.meta.gap;
 }
 
@@ -1620,6 +1618,7 @@ static inline unsigned long mas_max_gap(struct ma_state *mas)
                return mas_leaf_max_gap(mas);
 
        node = mas_mn(mas);
+       MT_WARN_ON(mas->tree, mt != maple_arange_64);
        offset = ma_meta_gap(node, mt);
        if (offset == MAPLE_ARANGE64_META_MAX)
                return 0;
@@ -1653,6 +1652,7 @@ static inline void mas_parent_gap(struct ma_state *mas, unsigned char offset,
        pgaps = ma_gaps(pnode, pmt);
 
 ascend:
+       MT_WARN_ON(mas->tree, pmt != maple_arange_64);
        meta_offset = ma_meta_gap(pnode, pmt);
        if (meta_offset == MAPLE_ARANGE64_META_MAX)
                meta_gap = 0;