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=38daf8125a546671acd3baec61e3892eeb29eaf5;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 1d6b370ef4d7..c916a27c0ab9 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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;