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", diff --git a/utils.c b/utils.c index 393e573e..e164fdd5 100644 --- a/utils.c +++ b/utils.c @@ -1420,7 +1420,6 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg, } /* and write out the super block */ - BUG_ON(sizeof(super) > cfg->sectorsize); memset(buf->data, 0, BTRFS_SUPER_INFO_SIZE); memcpy(buf->data, &super, sizeof(super)); buf->len = BTRFS_SUPER_INFO_SIZE;