aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hpfs/super.c')
-rw-r--r--fs/hpfs/super.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index a0617e706957..4334cda8dba1 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -121,7 +121,7 @@ unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno)
121 unsigned long *bits; 121 unsigned long *bits;
122 unsigned count; 122 unsigned count;
123 123
124 bits = hpfs_map_4sectors(s, secno, &qbh, 4); 124 bits = hpfs_map_4sectors(s, secno, &qbh, 0);
125 if (!bits) 125 if (!bits)
126 return 0; 126 return 0;
127 count = bitmap_weight(bits, 2048 * BITS_PER_BYTE); 127 count = bitmap_weight(bits, 2048 * BITS_PER_BYTE);
@@ -134,8 +134,13 @@ static unsigned count_bitmaps(struct super_block *s)
134 unsigned n, count, n_bands; 134 unsigned n, count, n_bands;
135 n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; 135 n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14;
136 count = 0; 136 count = 0;
137 for (n = 0; n < n_bands; n++) 137 for (n = 0; n < COUNT_RD_AHEAD; n++) {
138 hpfs_prefetch_bitmap(s, n);
139 }
140 for (n = 0; n < n_bands; n++) {
141 hpfs_prefetch_bitmap(s, n + COUNT_RD_AHEAD);
138 count += hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n])); 142 count += hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n]));
143 }
139 return count; 144 return count;
140} 145}
141 146
@@ -558,7 +563,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
558 sbi->sb_cp_table = NULL; 563 sbi->sb_cp_table = NULL;
559 sbi->sb_c_bitmap = -1; 564 sbi->sb_c_bitmap = -1;
560 sbi->sb_max_fwd_alloc = 0xffffff; 565 sbi->sb_max_fwd_alloc = 0xffffff;
561 566
567 if (sbi->sb_fs_size >= 0x80000000) {
568 hpfs_error(s, "invalid size in superblock: %08x",
569 (unsigned)sbi->sb_fs_size);
570 goto bail4;
571 }
572
562 /* Load bitmap directory */ 573 /* Load bitmap directory */
563 if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps)))) 574 if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps))))
564 goto bail4; 575 goto bail4;