aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ext2fs/openfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ext2fs/openfs.c')
-rw-r--r--lib/ext2fs/openfs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index fd56a9acd..eb44d5864 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -330,13 +330,14 @@ retry:
}
/* Enforce the block group descriptor size */
- if (!(flags & EXT2_FLAG_IGNORE_SB_ERRORS) &&
- ext2fs_has_feature_64bit(fs->super)) {
+ if (ext2fs_has_feature_64bit(fs->super)) {
unsigned desc_size = fs->super->s_desc_size;
- if ((desc_size < EXT2_MIN_DESC_SIZE_64BIT) ||
- (desc_size > EXT2_MAX_DESC_SIZE) ||
- (desc_size & (desc_size - 1)) != 0) {
+ if (desc_size == 0 ||
+ (!(flags & EXT2_FLAG_IGNORE_SB_ERRORS) &&
+ ((desc_size > EXT2_MAX_DESC_SIZE) ||
+ (desc_size < EXT2_MIN_DESC_SIZE_64BIT) ||
+ (desc_size & (desc_size - 1)) != 0))) {
retval = EXT2_ET_BAD_DESC_SIZE;
goto cleanup;
}