diff options
author | Steve Magnani <steve.magnani@digidescorp.com> | 2017-10-12 09:48:41 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2017-10-17 06:00:58 -0400 |
commit | fcbf7637e6647e00de04d4b2e05ece2484bb3062 (patch) | |
tree | 438535f802620428f7f42c6f44153b5fc5bfe29b /fs/udf/super.c | |
parent | b490bdd630cc43a5725e76c7c23f8a7e55551145 (diff) |
udf: Fix signed/unsigned format specifiers
Fix problems noted in compilion with -Wformat=2 -Wformat-signedness.
In particular, a mismatch between the signedness of a value and the
signedness of its format specifier can result in unsigned values being
printed as negative numbers, e.g.:
Partition (0 type 1511) starts at physical 460, block length -1779968542
...which occurs when mounting a large (> 1 TiB) UDF partition.
Changes since V1:
* Fixed additional issues noted in udf_bitmap_free_blocks(),
udf_get_fileident(), udf_show_options()
Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r-- | fs/udf/super.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c index 7ea0592e7f7c..f80e0a0f24d3 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -366,7 +366,7 @@ static int udf_show_options(struct seq_file *seq, struct dentry *root) | |||
366 | if (sbi->s_dmode != UDF_INVALID_MODE) | 366 | if (sbi->s_dmode != UDF_INVALID_MODE) |
367 | seq_printf(seq, ",dmode=%ho", sbi->s_dmode); | 367 | seq_printf(seq, ",dmode=%ho", sbi->s_dmode); |
368 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET)) | 368 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET)) |
369 | seq_printf(seq, ",session=%u", sbi->s_session); | 369 | seq_printf(seq, ",session=%d", sbi->s_session); |
370 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_LASTBLOCK_SET)) | 370 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_LASTBLOCK_SET)) |
371 | seq_printf(seq, ",lastblock=%u", sbi->s_last_block); | 371 | seq_printf(seq, ",lastblock=%u", sbi->s_last_block); |
372 | if (sbi->s_anchor != 0) | 372 | if (sbi->s_anchor != 0) |
@@ -705,7 +705,7 @@ static loff_t udf_check_vsd(struct super_block *sb) | |||
705 | 705 | ||
706 | sector += (((loff_t)sbi->s_session) << sb->s_blocksize_bits); | 706 | sector += (((loff_t)sbi->s_session) << sb->s_blocksize_bits); |
707 | 707 | ||
708 | udf_debug("Starting at sector %u (%ld byte sectors)\n", | 708 | udf_debug("Starting at sector %u (%lu byte sectors)\n", |
709 | (unsigned int)(sector >> sb->s_blocksize_bits), | 709 | (unsigned int)(sector >> sb->s_blocksize_bits), |
710 | sb->s_blocksize); | 710 | sb->s_blocksize); |
711 | /* Process the sequence (if applicable). The hard limit on the sector | 711 | /* Process the sequence (if applicable). The hard limit on the sector |
@@ -868,7 +868,7 @@ static int udf_find_fileset(struct super_block *sb, | |||
868 | 868 | ||
869 | if ((fileset->logicalBlockNum != 0xFFFFFFFF || | 869 | if ((fileset->logicalBlockNum != 0xFFFFFFFF || |
870 | fileset->partitionReferenceNum != 0xFFFF) && bh) { | 870 | fileset->partitionReferenceNum != 0xFFFF) && bh) { |
871 | udf_debug("Fileset at block=%d, partition=%d\n", | 871 | udf_debug("Fileset at block=%u, partition=%u\n", |
872 | fileset->logicalBlockNum, | 872 | fileset->logicalBlockNum, |
873 | fileset->partitionReferenceNum); | 873 | fileset->partitionReferenceNum); |
874 | 874 | ||
@@ -981,14 +981,14 @@ static int udf_load_metadata_files(struct super_block *sb, int partition, | |||
981 | mdata->s_phys_partition_ref = type1_index; | 981 | mdata->s_phys_partition_ref = type1_index; |
982 | 982 | ||
983 | /* metadata address */ | 983 | /* metadata address */ |
984 | udf_debug("Metadata file location: block = %d part = %d\n", | 984 | udf_debug("Metadata file location: block = %u part = %u\n", |
985 | mdata->s_meta_file_loc, mdata->s_phys_partition_ref); | 985 | mdata->s_meta_file_loc, mdata->s_phys_partition_ref); |
986 | 986 | ||
987 | fe = udf_find_metadata_inode_efe(sb, mdata->s_meta_file_loc, | 987 | fe = udf_find_metadata_inode_efe(sb, mdata->s_meta_file_loc, |
988 | mdata->s_phys_partition_ref); | 988 | mdata->s_phys_partition_ref); |
989 | if (IS_ERR(fe)) { | 989 | if (IS_ERR(fe)) { |
990 | /* mirror file entry */ | 990 | /* mirror file entry */ |
991 | udf_debug("Mirror metadata file location: block = %d part = %d\n", | 991 | udf_debug("Mirror metadata file location: block = %u part = %u\n", |
992 | mdata->s_mirror_file_loc, mdata->s_phys_partition_ref); | 992 | mdata->s_mirror_file_loc, mdata->s_phys_partition_ref); |
993 | 993 | ||
994 | fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc, | 994 | fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc, |
@@ -1012,7 +1012,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition, | |||
1012 | addr.logicalBlockNum = mdata->s_bitmap_file_loc; | 1012 | addr.logicalBlockNum = mdata->s_bitmap_file_loc; |
1013 | addr.partitionReferenceNum = mdata->s_phys_partition_ref; | 1013 | addr.partitionReferenceNum = mdata->s_phys_partition_ref; |
1014 | 1014 | ||
1015 | udf_debug("Bitmap file location: block = %d part = %d\n", | 1015 | udf_debug("Bitmap file location: block = %u part = %u\n", |
1016 | addr.logicalBlockNum, addr.partitionReferenceNum); | 1016 | addr.logicalBlockNum, addr.partitionReferenceNum); |
1017 | 1017 | ||
1018 | fe = udf_iget_special(sb, &addr); | 1018 | fe = udf_iget_special(sb, &addr); |
@@ -1042,7 +1042,7 @@ static void udf_load_fileset(struct super_block *sb, struct buffer_head *bh, | |||
1042 | 1042 | ||
1043 | UDF_SB(sb)->s_serial_number = le16_to_cpu(fset->descTag.tagSerialNum); | 1043 | UDF_SB(sb)->s_serial_number = le16_to_cpu(fset->descTag.tagSerialNum); |
1044 | 1044 | ||
1045 | udf_debug("Rootdir at block=%d, partition=%d\n", | 1045 | udf_debug("Rootdir at block=%u, partition=%u\n", |
1046 | root->logicalBlockNum, root->partitionReferenceNum); | 1046 | root->logicalBlockNum, root->partitionReferenceNum); |
1047 | } | 1047 | } |
1048 | 1048 | ||
@@ -1097,7 +1097,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, | |||
1097 | if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_OVERWRITABLE)) | 1097 | if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_OVERWRITABLE)) |
1098 | map->s_partition_flags |= UDF_PART_FLAG_OVERWRITABLE; | 1098 | map->s_partition_flags |= UDF_PART_FLAG_OVERWRITABLE; |
1099 | 1099 | ||
1100 | udf_debug("Partition (%d type %x) starts at physical %d, block length %d\n", | 1100 | udf_debug("Partition (%d type %x) starts at physical %u, block length %u\n", |
1101 | p_index, map->s_partition_type, | 1101 | p_index, map->s_partition_type, |
1102 | map->s_partition_root, map->s_partition_len); | 1102 | map->s_partition_root, map->s_partition_len); |
1103 | 1103 | ||
@@ -1122,7 +1122,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, | |||
1122 | } | 1122 | } |
1123 | map->s_uspace.s_table = inode; | 1123 | map->s_uspace.s_table = inode; |
1124 | map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE; | 1124 | map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE; |
1125 | udf_debug("unallocSpaceTable (part %d) @ %ld\n", | 1125 | udf_debug("unallocSpaceTable (part %d) @ %lu\n", |
1126 | p_index, map->s_uspace.s_table->i_ino); | 1126 | p_index, map->s_uspace.s_table->i_ino); |
1127 | } | 1127 | } |
1128 | 1128 | ||
@@ -1134,7 +1134,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, | |||
1134 | bitmap->s_extPosition = le32_to_cpu( | 1134 | bitmap->s_extPosition = le32_to_cpu( |
1135 | phd->unallocSpaceBitmap.extPosition); | 1135 | phd->unallocSpaceBitmap.extPosition); |
1136 | map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP; | 1136 | map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP; |
1137 | udf_debug("unallocSpaceBitmap (part %d) @ %d\n", | 1137 | udf_debug("unallocSpaceBitmap (part %d) @ %u\n", |
1138 | p_index, bitmap->s_extPosition); | 1138 | p_index, bitmap->s_extPosition); |
1139 | } | 1139 | } |
1140 | 1140 | ||
@@ -1157,7 +1157,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, | |||
1157 | } | 1157 | } |
1158 | map->s_fspace.s_table = inode; | 1158 | map->s_fspace.s_table = inode; |
1159 | map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE; | 1159 | map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE; |
1160 | udf_debug("freedSpaceTable (part %d) @ %ld\n", | 1160 | udf_debug("freedSpaceTable (part %d) @ %lu\n", |
1161 | p_index, map->s_fspace.s_table->i_ino); | 1161 | p_index, map->s_fspace.s_table->i_ino); |
1162 | } | 1162 | } |
1163 | 1163 | ||
@@ -1169,7 +1169,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, | |||
1169 | bitmap->s_extPosition = le32_to_cpu( | 1169 | bitmap->s_extPosition = le32_to_cpu( |
1170 | phd->freedSpaceBitmap.extPosition); | 1170 | phd->freedSpaceBitmap.extPosition); |
1171 | map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP; | 1171 | map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP; |
1172 | udf_debug("freedSpaceBitmap (part %d) @ %d\n", | 1172 | udf_debug("freedSpaceBitmap (part %d) @ %u\n", |
1173 | p_index, bitmap->s_extPosition); | 1173 | p_index, bitmap->s_extPosition); |
1174 | } | 1174 | } |
1175 | return 0; | 1175 | return 0; |
@@ -1282,7 +1282,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block) | |||
1282 | /* First scan for TYPE1 and SPARABLE partitions */ | 1282 | /* First scan for TYPE1 and SPARABLE partitions */ |
1283 | for (i = 0; i < sbi->s_partitions; i++) { | 1283 | for (i = 0; i < sbi->s_partitions; i++) { |
1284 | map = &sbi->s_partmaps[i]; | 1284 | map = &sbi->s_partmaps[i]; |
1285 | udf_debug("Searching map: (%d == %d)\n", | 1285 | udf_debug("Searching map: (%u == %u)\n", |
1286 | map->s_partition_num, partitionNumber); | 1286 | map->s_partition_num, partitionNumber); |
1287 | if (map->s_partition_num == partitionNumber && | 1287 | if (map->s_partition_num == partitionNumber && |
1288 | (map->s_partition_type == UDF_TYPE1_MAP15 || | 1288 | (map->s_partition_type == UDF_TYPE1_MAP15 || |
@@ -1291,7 +1291,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block) | |||
1291 | } | 1291 | } |
1292 | 1292 | ||
1293 | if (i >= sbi->s_partitions) { | 1293 | if (i >= sbi->s_partitions) { |
1294 | udf_debug("Partition (%d) not found in partition map\n", | 1294 | udf_debug("Partition (%u) not found in partition map\n", |
1295 | partitionNumber); | 1295 | partitionNumber); |
1296 | ret = 0; | 1296 | ret = 0; |
1297 | goto out_bh; | 1297 | goto out_bh; |
@@ -1483,7 +1483,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, | |||
1483 | struct metadataPartitionMap *mdm = | 1483 | struct metadataPartitionMap *mdm = |
1484 | (struct metadataPartitionMap *) | 1484 | (struct metadataPartitionMap *) |
1485 | &(lvd->partitionMaps[offset]); | 1485 | &(lvd->partitionMaps[offset]); |
1486 | udf_debug("Parsing Logical vol part %d type %d id=%s\n", | 1486 | udf_debug("Parsing Logical vol part %d type %u id=%s\n", |
1487 | i, type, UDF_ID_METADATA); | 1487 | i, type, UDF_ID_METADATA); |
1488 | 1488 | ||
1489 | map->s_partition_type = UDF_METADATA_MAP25; | 1489 | map->s_partition_type = UDF_METADATA_MAP25; |
@@ -1505,17 +1505,17 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, | |||
1505 | udf_debug("Metadata Ident suffix=0x%x\n", | 1505 | udf_debug("Metadata Ident suffix=0x%x\n", |
1506 | le16_to_cpu(*(__le16 *) | 1506 | le16_to_cpu(*(__le16 *) |
1507 | mdm->partIdent.identSuffix)); | 1507 | mdm->partIdent.identSuffix)); |
1508 | udf_debug("Metadata part num=%d\n", | 1508 | udf_debug("Metadata part num=%u\n", |
1509 | le16_to_cpu(mdm->partitionNum)); | 1509 | le16_to_cpu(mdm->partitionNum)); |
1510 | udf_debug("Metadata part alloc unit size=%d\n", | 1510 | udf_debug("Metadata part alloc unit size=%u\n", |
1511 | le32_to_cpu(mdm->allocUnitSize)); | 1511 | le32_to_cpu(mdm->allocUnitSize)); |
1512 | udf_debug("Metadata file loc=%d\n", | 1512 | udf_debug("Metadata file loc=%u\n", |
1513 | le32_to_cpu(mdm->metadataFileLoc)); | 1513 | le32_to_cpu(mdm->metadataFileLoc)); |
1514 | udf_debug("Mirror file loc=%d\n", | 1514 | udf_debug("Mirror file loc=%u\n", |
1515 | le32_to_cpu(mdm->metadataMirrorFileLoc)); | 1515 | le32_to_cpu(mdm->metadataMirrorFileLoc)); |
1516 | udf_debug("Bitmap file loc=%d\n", | 1516 | udf_debug("Bitmap file loc=%u\n", |
1517 | le32_to_cpu(mdm->metadataBitmapFileLoc)); | 1517 | le32_to_cpu(mdm->metadataBitmapFileLoc)); |
1518 | udf_debug("Flags: %d %d\n", | 1518 | udf_debug("Flags: %d %u\n", |
1519 | mdata->s_flags, mdm->flags); | 1519 | mdata->s_flags, mdm->flags); |
1520 | } else { | 1520 | } else { |
1521 | udf_debug("Unknown ident: %s\n", | 1521 | udf_debug("Unknown ident: %s\n", |
@@ -1525,7 +1525,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, | |||
1525 | map->s_volumeseqnum = le16_to_cpu(upm2->volSeqNum); | 1525 | map->s_volumeseqnum = le16_to_cpu(upm2->volSeqNum); |
1526 | map->s_partition_num = le16_to_cpu(upm2->partitionNum); | 1526 | map->s_partition_num = le16_to_cpu(upm2->partitionNum); |
1527 | } | 1527 | } |
1528 | udf_debug("Partition (%d:%d) type %d on volume %d\n", | 1528 | udf_debug("Partition (%d:%u) type %u on volume %u\n", |
1529 | i, map->s_partition_num, type, map->s_volumeseqnum); | 1529 | i, map->s_partition_num, type, map->s_volumeseqnum); |
1530 | } | 1530 | } |
1531 | 1531 | ||
@@ -1533,7 +1533,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, | |||
1533 | struct long_ad *la = (struct long_ad *)&(lvd->logicalVolContentsUse[0]); | 1533 | struct long_ad *la = (struct long_ad *)&(lvd->logicalVolContentsUse[0]); |
1534 | 1534 | ||
1535 | *fileset = lelb_to_cpu(la->extLocation); | 1535 | *fileset = lelb_to_cpu(la->extLocation); |
1536 | udf_debug("FileSet found in LogicalVolDesc at block=%d, partition=%d\n", | 1536 | udf_debug("FileSet found in LogicalVolDesc at block=%u, partition=%u\n", |
1537 | fileset->logicalBlockNum, | 1537 | fileset->logicalBlockNum, |
1538 | fileset->partitionReferenceNum); | 1538 | fileset->partitionReferenceNum); |
1539 | } | 1539 | } |
@@ -2159,7 +2159,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
2159 | ret = udf_load_vrs(sb, &uopt, silent, &fileset); | 2159 | ret = udf_load_vrs(sb, &uopt, silent, &fileset); |
2160 | if (ret < 0) { | 2160 | if (ret < 0) { |
2161 | if (!silent && ret != -EACCES) { | 2161 | if (!silent && ret != -EACCES) { |
2162 | pr_notice("Scanning with blocksize %d failed\n", | 2162 | pr_notice("Scanning with blocksize %u failed\n", |
2163 | uopt.blocksize); | 2163 | uopt.blocksize); |
2164 | } | 2164 | } |
2165 | brelse(sbi->s_lvid_bh); | 2165 | brelse(sbi->s_lvid_bh); |
@@ -2184,7 +2184,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
2184 | goto error_out; | 2184 | goto error_out; |
2185 | } | 2185 | } |
2186 | 2186 | ||
2187 | udf_debug("Lastblock=%d\n", sbi->s_last_block); | 2187 | udf_debug("Lastblock=%u\n", sbi->s_last_block); |
2188 | 2188 | ||
2189 | if (sbi->s_lvid_bh) { | 2189 | if (sbi->s_lvid_bh) { |
2190 | struct logicalVolIntegrityDescImpUse *lvidiu = | 2190 | struct logicalVolIntegrityDescImpUse *lvidiu = |
@@ -2255,7 +2255,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
2255 | /* perhaps it's not extensible enough, but for now ... */ | 2255 | /* perhaps it's not extensible enough, but for now ... */ |
2256 | inode = udf_iget(sb, &rootdir); | 2256 | inode = udf_iget(sb, &rootdir); |
2257 | if (IS_ERR(inode)) { | 2257 | if (IS_ERR(inode)) { |
2258 | udf_err(sb, "Error in udf_iget, block=%d, partition=%d\n", | 2258 | udf_err(sb, "Error in udf_iget, block=%u, partition=%u\n", |
2259 | rootdir.logicalBlockNum, rootdir.partitionReferenceNum); | 2259 | rootdir.logicalBlockNum, rootdir.partitionReferenceNum); |
2260 | ret = PTR_ERR(inode); | 2260 | ret = PTR_ERR(inode); |
2261 | goto error_out; | 2261 | goto error_out; |