From: Liam R. Howlett <Liam.Howlett@oracle.com> Date: Fri, 10 Feb 2023 21:47:25 +0000 (-0500) Subject: maple_tree: Handle MAS_NONE and MAS_PAUSE in mas_walk() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d395f2da4c706671abd2327033cc82b66ee2ad48;p=users%2Fjedix%2Flinux-maple.git maple_tree: Handle MAS_NONE and MAS_PAUSE in mas_walk() When walking the tree, handle MAS_NONE and MAS_PAUSE the same as MAS_START. This also fixes a potential error returned when re-walking a single entry tree of 0 - 0. Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 35c0f07f1e01..7783e7e7b59c 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5027,6 +5027,8 @@ void *mas_walk(struct ma_state *mas) { void *entry; + if (mas_is_none(mas) || mas_is_paused(mas)) + mas->node = MAS_START; retry: entry = mas_state_walk(mas); if (mas_is_start(mas)) @@ -5035,6 +5037,8 @@ retry: if (mas_is_ptr(mas)) { if (!mas->index) { mas->last = 0; + if (!entry) + entry = mas_root(mas); } else { mas->index = 1; mas->last = ULONG_MAX;