aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/super.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index b9dc6adfdd2d..3c2d35dc2577 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -731,13 +731,18 @@ static sector_t udf_scan_anchors(struct super_block *sb, sector_t lastblock)
731 sector_t last[6]; 731 sector_t last[6];
732 int i; 732 int i;
733 struct udf_sb_info *sbi = UDF_SB(sb); 733 struct udf_sb_info *sbi = UDF_SB(sb);
734 734 int last_count = 0;
735 last[0] = lastblock; 735
736 last[1] = last[0] - 1; 736 last[last_count++] = lastblock;
737 last[2] = last[0] + 1; 737 if (lastblock >= 1)
738 last[3] = last[0] - 2; 738 last[last_count++] = lastblock - 1;
739 last[4] = last[0] - 150; 739 last[last_count++] = lastblock + 1;
740 last[5] = last[0] - 152; 740 if (lastblock >= 2)
741 last[last_count++] = lastblock - 2;
742 if (lastblock >= 150)
743 last[last_count++] = lastblock - 150;
744 if (lastblock >= 152)
745 last[last_count++] = lastblock - 152;
741 746
742 /* according to spec, anchor is in either: 747 /* according to spec, anchor is in either:
743 * block 256 748 * block 256
@@ -745,7 +750,7 @@ static sector_t udf_scan_anchors(struct super_block *sb, sector_t lastblock)
745 * lastblock 750 * lastblock
746 * however, if the disc isn't closed, it could be 512 */ 751 * however, if the disc isn't closed, it could be 512 */
747 752
748 for (i = 0; i < ARRAY_SIZE(last); i++) { 753 for (i = 0; i < last_count; i++) {
749 if (last[i] >= sb->s_bdev->bd_inode->i_size >> 754 if (last[i] >= sb->s_bdev->bd_inode->i_size >>
750 sb->s_blocksize_bits) 755 sb->s_blocksize_bits)
751 continue; 756 continue;