Commit e1a373db authored by Alasdair G. Kergon's avatar Alasdair G. Kergon Committed by Linus Torvalds

[PATCH] device-mapper: fix minor number check

Fix minor number allocation check: (1 << MINORBITS) is invalid.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e2971d1c
......@@ -647,7 +647,7 @@ static int specific_minor(unsigned int minor)
{
int r, m;
if (minor > (1 << MINORBITS))
if (minor >= (1 << MINORBITS))
return -EINVAL;
down(&_minor_lock);
......@@ -697,7 +697,7 @@ static int next_free_minor(unsigned int *minor)
goto out;
}
if (m > (1 << MINORBITS)) {
if (m >= (1 << MINORBITS)) {
idr_remove(&_minor_idr, m);
r = -ENOSPC;
goto out;
......
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