[PATCH fixup] maple_tree: Fix dereference of rcu type

From: Liam R. Howlett (Oracle)

Date: Mon Jun 29 2026 - 11:37:48 EST


When getting the slot, the rcu type of the slot needs to use
rcu_dereference_protected() to ensure no locking issues.

Signed-off-by: Liam R. Howlett (Oracle) <liam@xxxxxxxxxxxxx>
---
lib/maple_tree.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Andrew,

Please apply this fix to "[PATCH 11/18] maple_tree: Add bulk parent set
helper" to avoid type complaints.

Thanks,
Liam

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index eb7f32081b65d..f1b9c9b32bd42 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -525,8 +525,10 @@ void mas_set_parent_slots(struct ma_state *mas, struct maple_enode *parent,

for (i = 0; i < count; i++) {
unsigned long pval = val | ((start_slot + i) << shift) | type;
- struct maple_enode *child = (struct maple_enode *)slots[i];
+ struct maple_enode *child;

+ child = ma_enode_ptr(rcu_dereference_protected(slots[i],
+ mt_locked(mas->tree)));
mte_to_node(child)->parent = ma_parent_ptr(pval);
}
}
--
2.47.3