From: Liam R. Howlett Date: Wed, 17 Sep 2025 01:00:18 +0000 (-0400) Subject: node_copy: Fix d_max return value X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ab642334d92130377107b86190c25b51d6f319ad;p=users%2Fjedix%2Flinux-maple.git node_copy: Fix d_max return value Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index f84c8cef9b06..633ee584e755 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2951,11 +2951,10 @@ unsigned long node_copy(struct ma_state *mas, struct maple_node *src, memcpy(d_gaps, s_gaps, size * sizeof(unsigned long)); } - d_max = s_max; - if (start + size < mt_pivots[s_mt]) { - if (s_max > s_pivots[size - 1]) - d_max = s_pivots[size - 1]; - } + if (start + size - 1 < mt_pivots[s_mt]) + d_max = s_pivots[size - 1]; + else + d_max = s_max; if (d_start + size <= mt_pivots[d_mt]) d_pivots[size - 1] = d_max;