]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Fix mas_dead_node for a trivial tree
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 13 Oct 2019 03:21:36 +0000 (23:21 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 13 Oct 2019 03:26:31 +0000 (23:26 -0400)
For a tree with no entries, or an entry only at 0, mas_dead_node()
can be called with a mas->node of NULL.  This node is, by definition,
not dead.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
lib/maple_tree.c

index 1d6b370ef4d7da20fcec08dbbae4b197ca8123f9..c916a27c0ab9758037f05449fc8ab09c9aaa4685 100644 (file)
@@ -3331,6 +3331,8 @@ static inline int mas_safe_slot(struct ma_state *mas, unsigned char *slot,
 
 static inline int mas_dead_node(struct ma_state *mas, unsigned long index)
 {
+       if (!mas->node)
+               return 0;
        if (!mt_dead_node(mas->node))
                return 0;