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