Fix: Be paranoid and check that last is in range

This commit is contained in:
Denis Kenzior 2010-01-07 14:42:46 -06:00
parent bdfa90bd14
commit 230bddf30e
1 changed files with 3 additions and 0 deletions

View File

@ -176,6 +176,9 @@ unsigned int idmap_alloc_next(struct idmap *idmap, unsigned int last)
unsigned int bit;
unsigned int offset;
if (last < idmap->min || last > idmap->max)
return idmap->max + 1;
bit = find_next_zero_bit(idmap->bits, idmap->size,
last - idmap->min + 1);