diff options
-rw-r--r-- | fs/hpfs/map.c | 3 | ||||
-rw-r--r-- | fs/hpfs/super.c | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/fs/hpfs/map.c b/fs/hpfs/map.c index 4acb19d78359..803d3da3a0fe 100644 --- a/fs/hpfs/map.c +++ b/fs/hpfs/map.c | |||
@@ -17,7 +17,8 @@ __le32 *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block, | |||
17 | struct quad_buffer_head *qbh, char *id) | 17 | struct quad_buffer_head *qbh, char *id) |
18 | { | 18 | { |
19 | secno sec; | 19 | secno sec; |
20 | if (hpfs_sb(s)->sb_chk) if (bmp_block * 16384 > hpfs_sb(s)->sb_fs_size) { | 20 | unsigned n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; |
21 | if (hpfs_sb(s)->sb_chk) if (bmp_block >= n_bands) { | ||
21 | hpfs_error(s, "hpfs_map_bitmap called with bad parameter: %08x at %s", bmp_block, id); | 22 | hpfs_error(s, "hpfs_map_bitmap called with bad parameter: %08x at %s", bmp_block, id); |
22 | return NULL; | 23 | return NULL; |
23 | } | 24 | } |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index a0617e706957..962e90c37aec 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -558,7 +558,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
558 | sbi->sb_cp_table = NULL; | 558 | sbi->sb_cp_table = NULL; |
559 | sbi->sb_c_bitmap = -1; | 559 | sbi->sb_c_bitmap = -1; |
560 | sbi->sb_max_fwd_alloc = 0xffffff; | 560 | sbi->sb_max_fwd_alloc = 0xffffff; |
561 | 561 | ||
562 | if (sbi->sb_fs_size >= 0x80000000) { | ||
563 | hpfs_error(s, "invalid size in superblock: %08x", | ||
564 | (unsigned)sbi->sb_fs_size); | ||
565 | goto bail4; | ||
566 | } | ||
567 | |||
562 | /* Load bitmap directory */ | 568 | /* Load bitmap directory */ |
563 | if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps)))) | 569 | if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps)))) |
564 | goto bail4; | 570 | goto bail4; |