Skip to contentSkip to conversation

maple_tree: Fix mas_empty_area() wrapping

PATCH In review Liam Howlett 2 participants 2 messages Jul 19, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 maple_tree: Fix mas_empty_area() wrapping

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

---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/maple_tree.c +1 -1
index 1b8130f19c2e..0c0bda979693 100644
@@ -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;
 		}
Signature · 1 line
2.35.1
Tested-by on v1 1/1
#1 lore raw
Quoted 5 lines · Liam Howlett

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

That fixes it, thanks!

Quoted 17 lines
---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/maple_tree.c +1 -1
index 1b8130f19c2e..0c0bda979693 100644
@@ -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;
 		}