From: Matthew Wilcox (Oracle) Date: Sun, 13 Oct 2019 03:21:36 +0000 (-0400) Subject: maple_tree: Fix mas_dead_node for a trivial tree X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=58e87d397110e9de6f098175f5897d45a79afff8;p=users%2Fjedix%2Flinux-maple.git maple_tree: Fix mas_dead_node for a trivial tree 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) --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 350551179c33..3283ce5cb3c9 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3303,7 +3303,9 @@ 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 (!mte_dead_node(mas->node)) + if (!mas->node) + return 0; + if (!mt_dead_node(mas->node)) return 0; mas->index = index;