Skip to contentSkip to conversation

mtd: Raise limit on block device minor numbers

PATCH In review Ben Hutchings 1 participant 2 messages Jan 12, 2010 – Jan 14, 2010 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH v2 7/7 mtd: Raise limit on block device minor numbers

add_mtd_blktrans_dev() imposes a maximum of 257 devices per block translator. This was presumably meant to prevent overflow back in the days of 8-bit minor numbers. Since we now have 20-bit minor numbers and can have more than 32 MTDs, change the maximum to MINORMASK.

---
 drivers/mtd/mtd_blkdevs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/mtd_blkdevs.c +1 -1
index 85a52b3..5e88b49 100644
@@ -242,7 +242,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
 	if (new->devnum == -1)
 		new->devnum = last_devnum+1;
 
-	if ((new->devnum << tr->part_bits) > 256) {
+	if ((new->devnum << tr->part_bits) > MINORMASK) {
 		return -EBUSY;
 	}
 
Signature · 6 lines
1.5.5

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#1 lore raw
Quoted 15 lines · Ben Hutchings

add_mtd_blktrans_dev() imposes a maximum of 257 devices per block translator. This was presumably meant to prevent overflow back in the days of 8-bit minor numbers. Since we now have 20-bit minor numbers and can have more than 32 MTDs, change the maximum to MINORMASK.

---
 drivers/mtd/mtd_blkdevs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/mtd_blkdevs.c +0 -0
index 85a52b3..5e88b49 100644

drivers/mtd/mtd_blkdevs.c int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) · line 245

Quoted 5 lines
drivers/mtd/mtd_blkdevs.c +1 -1
@@ -242,7 +242,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
 	if (new->devnum == -1)
 		new->devnum = last_devnum+1;
 
-	if ((new->devnum << tr->part_bits) > 256) {
+	if ((new->devnum << tr->part_bits) > MINORMASK) {

Actually this still has a boundary error. I think the correct condition is:

	new->devnum > (MINORMASK >> tr->part_bits)

Ben.

Quoted 6 lines
drivers/mtd/mtd_blkdevs.c +0 -0
 		return -EBUSY;
 	}
 
Signature · 1 line
1.5.5
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.