diff mbox series

[2/3] maple_tree: restart walk on correct status

Message ID 20250208011852.31434-3-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series may miss to set node dead on destroy | expand

Commit Message

Wei Yang Feb. 8, 2025, 1:18 a.m. UTC
Commit a8091f039c1e ("maple_tree: add MAS_UNDERFLOW and MAS_OVERFLOW
states") adds more status during maple tree walk. But it introduce a
typo on the status check during walk.

It expects to mean neither active nor start, we would restart the walk,
while current code means we would always restart the walk.

Fixes: a8091f039c1e ("maple_tree: add MAS_UNDERFLOW and MAS_OVERFLOW states")
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
CC: <stable@vger.kernel.org>
---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Liam R. Howlett Feb. 10, 2025, 2:20 p.m. UTC | #1
* Wei Yang <richard.weiyang@gmail.com> [250207 20:26]:
> Commit a8091f039c1e ("maple_tree: add MAS_UNDERFLOW and MAS_OVERFLOW
> states") adds more status during maple tree walk. But it introduce a
> typo on the status check during walk.
> 
> It expects to mean neither active nor start, we would restart the walk,
> while current code means we would always restart the walk.
> 
> Fixes: a8091f039c1e ("maple_tree: add MAS_UNDERFLOW and MAS_OVERFLOW states")
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
> CC: <stable@vger.kernel.org>

Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>

> ---
>  lib/maple_tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index d31f0a2858f7..e64ffa5b9970 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -4899,7 +4899,7 @@ void *mas_walk(struct ma_state *mas)
>  {
>  	void *entry;
>  
> -	if (!mas_is_active(mas) || !mas_is_start(mas))
> +	if (!mas_is_active(mas) && !mas_is_start(mas))
>  		mas->status = ma_start;
>  retry:
>  	entry = mas_state_walk(mas);
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index d31f0a2858f7..e64ffa5b9970 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -4899,7 +4899,7 @@  void *mas_walk(struct ma_state *mas)
 {
 	void *entry;
 
-	if (!mas_is_active(mas) || !mas_is_start(mas))
+	if (!mas_is_active(mas) && !mas_is_start(mas))
 		mas->status = ma_start;
 retry:
 	entry = mas_state_walk(mas);