From 28521cc40f752da1635fb43727d99a87cee52af0 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Tue, 4 Dec 2018 12:25:17 -0500 Subject: [PATCH] lib/maple_tree: Fix expand root to correctly set up non-zero pivots. When expanding the root node, be sure to only add a pivot at 0 if there was a previous value, otherwise add a pivot for one less than the pending insert. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index f7189062a38f..05c6b3d82436 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -269,8 +269,12 @@ static int _maple_root_expand(struct maple_state *ms) * rcu_assign is not necessary as readers are not able to access this * node. */ - RCU_INIT_POINTER(mn->map64.slot[0], r_entry); - mn->map64.pivot[0] = 1; + if (r_entry != NULL) { + RCU_INIT_POINTER(mn->map64.slot[0], r_entry); + mn->map64.pivot[0] = 1; + } else { + mn->map64.pivot[0] = ms->index; + } ms->slot_idx = 1; -- 2.50.1