From: Liam R. Howlett Date: Thu, 18 Feb 2021 14:27:48 +0000 (-0500) Subject: lib/maple_tree: Fix mas_store_gfp() on spanning store. X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=fa29820dbc6772575958474af1a49f358ce84378;p=users%2Fjedix%2Flinux-maple.git lib/maple_tree: Fix mas_store_gfp() on spanning store. Spanning store detection needs to be more robust than checking if it spans the end of a node. Fix the detection by using mas_is_span_wr(). Also ensure it's not MAS_NONE. Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 000b49f4f1d8..329634edd8a8 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5193,9 +5193,8 @@ void *mas_store(struct ma_state *mas, void *entry) int mas_store_gfp(struct ma_state *mas, void *entry, gfp_t gfp) { - // Detect spanning store. - if ((mas->last == mas->max && !entry) || - (mas->last > mas->max)) + if (mas_is_span_wr(mas, mas->max, mte_node_type(mas->node), entry) || + mas_is_none(mas)) mas->node = MAS_START; retry: