linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] maple_tree: Fix mas_empty_area() wrapping
@ 2022-07-19 17:01 Liam Howlett
  2022-07-19 17:39 ` Sven Schnelle
  0 siblings, 1 reply; 2+ messages in thread
From: Liam Howlett @ 2022-07-19 17:01 UTC (permalink / raw)
  To: maple-tree, linux-mm, linux-kernel, Andrew Morton, Yu Zhao,
	Hugh Dickins, Sven Schnelle

Set the error code correctly when at the left most node and search has
been exhausted.  This was an overflow bug.

Reported-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-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 1b8130f19c2e..0c0bda979693 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -4994,7 +4994,7 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
 		}
 next_slot:
 		min = pivot + 1;
-		if (mas->last < min) {
+		if (mas->last <= pivot) {
 			mas_set_err(mas, -EBUSY);
 			return true;
 		}
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] maple_tree: Fix mas_empty_area() wrapping
  2022-07-19 17:01 [PATCH] maple_tree: Fix mas_empty_area() wrapping Liam Howlett
@ 2022-07-19 17:39 ` Sven Schnelle
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Schnelle @ 2022-07-19 17:39 UTC (permalink / raw)
  To: Liam Howlett
  Cc: maple-tree, linux-mm, linux-kernel, Andrew Morton, Yu Zhao, Hugh Dickins

Liam Howlett <liam.howlett@oracle.com> writes:

> Set the error code correctly when at the left most node and search has
> been exhausted.  This was an overflow bug.
>
> Reported-by: Sven Schnelle <svens@linux.ibm.com>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>

That fixes it, thanks!

Tested-by: Sven Schnelle <svens@linux.ibm.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 1b8130f19c2e..0c0bda979693 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -4994,7 +4994,7 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
>  		}
>  next_slot:
>  		min = pivot + 1;
> -		if (mas->last < min) {
> +		if (mas->last <= pivot) {
>  			mas_set_err(mas, -EBUSY);
>  			return true;
>  		}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-19 17:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19 17:01 [PATCH] maple_tree: Fix mas_empty_area() wrapping Liam Howlett
2022-07-19 17:39 ` Sven Schnelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).