Commit 6e6d3014 authored by Matthew Wilcox's avatar Matthew Wilcox

IDR test suite: Check handling negative end correctly

One of the charming quirks of the idr_alloc() interface is that you
can pass a negative end and it will be interpreted as "maximum".  Ensure
we don't break that.
Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
parent 490645d0
...@@ -207,6 +207,7 @@ void idr_checks(void) ...@@ -207,6 +207,7 @@ void idr_checks(void)
assert(idr_alloc(&idr, item, i, i + 10, GFP_KERNEL) == i); assert(idr_alloc(&idr, item, i, i + 10, GFP_KERNEL) == i);
} }
assert(idr_alloc(&idr, DUMMY_PTR, i - 2, i, GFP_KERNEL) == -ENOSPC); assert(idr_alloc(&idr, DUMMY_PTR, i - 2, i, GFP_KERNEL) == -ENOSPC);
assert(idr_alloc(&idr, DUMMY_PTR, i - 2, i + 10, GFP_KERNEL) == -ENOSPC);
idr_for_each(&idr, item_idr_free, &idr); idr_for_each(&idr, item_idr_free, &idr);
idr_destroy(&idr); idr_destroy(&idr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment