Skip to contentSkip to conversation

device-mapper: fix minor number check

PATCH New Alasdair G Kergon 1 participant 1 message Sep 21, 2004 Device mapper

lore
Share & tools
lore

Alasdair G Kergon

author maintainer
#0 lore raw

PATCH 1/1 device-mapper: fix minor number check

Fix minor number allocation check: (1 << MINORBITS) is invalid.

drivers/md/dm.c +2 -2
@@ -647,7 +647,7 @@
 {
 	int r, m;
 
-	if (minor > (1 << MINORBITS))
+	if (minor >= (1 << MINORBITS))
 		return -EINVAL;
 
 	down(&_minor_lock);
@@ -697,7 +697,7 @@
 		goto out;
 	}
 
-	if (m > (1 << MINORBITS)) {
+	if (m >= (1 << MINORBITS)) {
 		idr_remove(&_minor_idr, m);
 		r = -ENOSPC;
 		goto out;