goto cleanup;
fs->image_io = fs->io;
fs->io->app_data = fs;
- retval = ext2fs_get_memalign(SUPERBLOCK_SIZE, 512, &fs->super);
+ retval = io_channel_alloc_buf(fs->io, -SUPERBLOCK_SIZE, &fs->super);
if (retval)
goto cleanup;
if (flags & EXT2_FLAG_IMAGE_FILE) {
retval = EXT2_ET_CORRUPT_SUPERBLOCK;
goto cleanup;
}
+
+ /* Enforce the block group descriptor size */
+ if (fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) {
+ if (fs->super->s_desc_size != EXT2_MIN_DESC_SIZE_64BIT) {
+ retval = EXT2_ET_BAD_DESC_SIZE;
+ goto cleanup;
+ }
+ } else {
+ if (fs->super->s_desc_size &&
+ fs->super->s_desc_size != EXT2_MIN_DESC_SIZE) {
+ retval = EXT2_ET_BAD_DESC_SIZE;
+ goto cleanup;
+ }
+ }
+
fs->cluster_ratio_bits = fs->super->s_log_cluster_size -
fs->super->s_log_block_size;
if (EXT2_BLOCKS_PER_GROUP(fs->super) !=
retval = EXT2_ET_CORRUPT_SUPERBLOCK;
goto cleanup;
}
+ /* Precompute the FS UUID to seed other checksums */
+ ext2fs_init_csum_seed(fs);
/*
* Read group descriptors