When iterating, a user may modify the tree and cause the iterator to be
out of range. Detect this scenario and correct it by setting to the
limit and invalidating the state.
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
unsigned long last;
enum maple_type mt;
+ if (mas->index > limit) {
+ mas->index = mas->last = limit;
+ mas_pause(mas);
+ return NULL;
+ }
last = mas->last;
retry:
offset = mas->offset;
{
void *entry;
+ if (mas->index < min) {
+ mas->index = mas->last = min;
+ mas_pause(mas);
+ return NULL;
+ }
retry:
while (likely(!mas_is_none(mas))) {
entry = mas_prev_nentry(mas, min, mas->index);