In mkfs.btrfs, the sector size must be a power of two for the second half of the leafsize and nodesize checks to work, but sectorsize is never validated.
# diff -u mkfs.c- mkfs.c --- mkfs.c- 2009-01-20 11:37:39.000000000 -0800 +++ mkfs.c 2009-01-22 10:13:49.000000000 -0800 @@ -391,14 +391,22 @@ } } sectorsize = max(sectorsize, (u32)getpagesize()); + if ((sectorsize & (sectorsize - 1))) { + fprintf(stderr, "Sector size %u must be a power of 2\n", + sectorsize); + exit(1); + } + if (leafsize < sectorsize || (leafsize & (sectorsize - 1))) { fprintf(stderr, "Illegal leafsize %u\n", leafsize); exit(1); } + if (nodesize < sectorsize || (nodesize & (sectorsize - 1))) { fprintf(stderr, "Illegal nodesize %u\n", nodesize); exit(1); } + ac = ac - optind; if (ac == 0) print_usage(); # -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html