diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index ef4ea3f21905..258186a8bb03 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -766,15 +766,23 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size, goto out; /* Check MFT record size. */ + if (boot->record_size < 0 && + -boot->record_size > 31) + goto out; + if ((boot->record_size < 0 && - SECTOR_SIZE > (2U << (-boot->record_size))) || + SECTOR_SIZE > (2UL << (-boot->record_size))) || (boot->record_size >= 0 && !is_power_of_2(boot->record_size))) { goto out; } /* Check index record size. */ + if (boot->index_size < 0 && + -boot->index_size > 31) + goto out; + if ((boot->index_size < 0 && - SECTOR_SIZE > (2U << (-boot->index_size))) || + (SECTOR_SIZE > (2UL << (-boot->index_size)))) || (boot->index_size >= 0 && !is_power_of_2(boot->index_size))) { goto out; }