From 38daf8125a546671acd3baec61e3892eeb29eaf5 Mon Sep 17 00:00:00 2001 From: "Matthew Wilcox (Oracle)" Date: Sat, 12 Oct 2019 23:21:36 -0400 Subject: [PATCH] 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) --- lib/maple_tree.c | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.50.1