summaryrefslogtreecommitdiff
path: root/mkfs.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-08-31 20:16:35 +0200
committerDavid Sterba <dsterba@suse.com>2016-09-21 14:12:38 +0200
commitb318553f33dc59b6afdc7d264dcfbfe835ccc3d4 (patch)
tree0fe836d65af75642fb3950545e9846c1e100f953 /mkfs.c
parent976f6adfb5bfe71acbb15a200262cef8f07d77b3 (diff)
btrfs-progs: mkfs: check for sane sectorsize earlier
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'mkfs.c')
-rw-r--r--mkfs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mkfs.c b/mkfs.c
index 4b88987c..a4b0ce7c 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1636,6 +1636,12 @@ int main(int argc, char **argv)
features))
exit(1);
+ if (sectorsize < sizeof(struct btrfs_super_block)) {
+ error("sectorsize smaller than superblock: %u < %zu",
+ sectorsize, sizeof(struct btrfs_super_block));
+ exit(1);
+ }
+
/* Check device/block_count after the nodesize is determined */
if (block_count && block_count < btrfs_min_dev_size(nodesize)) {
error("size %llu is too small to make a usable filesystem",