diff options
Diffstat (limited to 'fs/udf/misc.c')
| -rw-r--r-- | fs/udf/misc.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/udf/misc.c b/fs/udf/misc.c index a1d6da0caf71..84bf0fd4a4f1 100644 --- a/fs/udf/misc.c +++ b/fs/udf/misc.c | |||
| @@ -23,8 +23,8 @@ | |||
| 23 | 23 | ||
| 24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
| 25 | #include <linux/string.h> | 25 | #include <linux/string.h> |
| 26 | #include <linux/udf_fs.h> | ||
| 27 | #include <linux/buffer_head.h> | 26 | #include <linux/buffer_head.h> |
| 27 | #include <linux/crc-itu-t.h> | ||
| 28 | 28 | ||
| 29 | #include "udf_i.h" | 29 | #include "udf_i.h" |
| 30 | #include "udf_sb.h" | 30 | #include "udf_sb.h" |
| @@ -136,8 +136,8 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size, | |||
| 136 | /* rewrite CRC + checksum of eahd */ | 136 | /* rewrite CRC + checksum of eahd */ |
| 137 | crclen = sizeof(struct extendedAttrHeaderDesc) - sizeof(tag); | 137 | crclen = sizeof(struct extendedAttrHeaderDesc) - sizeof(tag); |
| 138 | eahd->descTag.descCRCLength = cpu_to_le16(crclen); | 138 | eahd->descTag.descCRCLength = cpu_to_le16(crclen); |
| 139 | eahd->descTag.descCRC = cpu_to_le16(udf_crc((char *)eahd + | 139 | eahd->descTag.descCRC = cpu_to_le16(crc_itu_t(0, (char *)eahd + |
| 140 | sizeof(tag), crclen, 0)); | 140 | sizeof(tag), crclen)); |
| 141 | eahd->descTag.tagChecksum = udf_tag_checksum(&eahd->descTag); | 141 | eahd->descTag.tagChecksum = udf_tag_checksum(&eahd->descTag); |
| 142 | iinfo->i_lenEAttr += size; | 142 | iinfo->i_lenEAttr += size; |
| 143 | return (struct genericFormat *)&ea[offset]; | 143 | return (struct genericFormat *)&ea[offset]; |
| @@ -204,16 +204,15 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, | |||
| 204 | { | 204 | { |
| 205 | tag *tag_p; | 205 | tag *tag_p; |
| 206 | struct buffer_head *bh = NULL; | 206 | struct buffer_head *bh = NULL; |
| 207 | struct udf_sb_info *sbi = UDF_SB(sb); | ||
| 208 | 207 | ||
| 209 | /* Read the block */ | 208 | /* Read the block */ |
| 210 | if (block == 0xFFFFFFFF) | 209 | if (block == 0xFFFFFFFF) |
| 211 | return NULL; | 210 | return NULL; |
| 212 | 211 | ||
| 213 | bh = udf_tread(sb, block + sbi->s_session); | 212 | bh = udf_tread(sb, block); |
| 214 | if (!bh) { | 213 | if (!bh) { |
| 215 | udf_debug("block=%d, location=%d: read failed\n", | 214 | udf_debug("block=%d, location=%d: read failed\n", |
| 216 | block + sbi->s_session, location); | 215 | block, location); |
| 217 | return NULL; | 216 | return NULL; |
| 218 | } | 217 | } |
| 219 | 218 | ||
| @@ -223,8 +222,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, | |||
| 223 | 222 | ||
| 224 | if (location != le32_to_cpu(tag_p->tagLocation)) { | 223 | if (location != le32_to_cpu(tag_p->tagLocation)) { |
| 225 | udf_debug("location mismatch block %u, tag %u != %u\n", | 224 | udf_debug("location mismatch block %u, tag %u != %u\n", |
| 226 | block + sbi->s_session, | 225 | block, le32_to_cpu(tag_p->tagLocation), location); |
| 227 | le32_to_cpu(tag_p->tagLocation), location); | ||
| 228 | goto error_out; | 226 | goto error_out; |
| 229 | } | 227 | } |
| 230 | 228 | ||
| @@ -244,13 +242,13 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, | |||
| 244 | 242 | ||
| 245 | /* Verify the descriptor CRC */ | 243 | /* Verify the descriptor CRC */ |
| 246 | if (le16_to_cpu(tag_p->descCRCLength) + sizeof(tag) > sb->s_blocksize || | 244 | if (le16_to_cpu(tag_p->descCRCLength) + sizeof(tag) > sb->s_blocksize || |
| 247 | le16_to_cpu(tag_p->descCRC) == udf_crc(bh->b_data + sizeof(tag), | 245 | le16_to_cpu(tag_p->descCRC) == crc_itu_t(0, |
| 248 | le16_to_cpu(tag_p->descCRCLength), 0)) | 246 | bh->b_data + sizeof(tag), |
| 247 | le16_to_cpu(tag_p->descCRCLength))) | ||
| 249 | return bh; | 248 | return bh; |
| 250 | 249 | ||
| 251 | udf_debug("Crc failure block %d: crc = %d, crclen = %d\n", | 250 | udf_debug("Crc failure block %d: crc = %d, crclen = %d\n", block, |
| 252 | block + sbi->s_session, le16_to_cpu(tag_p->descCRC), | 251 | le16_to_cpu(tag_p->descCRC), le16_to_cpu(tag_p->descCRCLength)); |
| 253 | le16_to_cpu(tag_p->descCRCLength)); | ||
| 254 | 252 | ||
| 255 | error_out: | 253 | error_out: |
| 256 | brelse(bh); | 254 | brelse(bh); |
| @@ -270,7 +268,7 @@ void udf_update_tag(char *data, int length) | |||
| 270 | length -= sizeof(tag); | 268 | length -= sizeof(tag); |
| 271 | 269 | ||
| 272 | tptr->descCRCLength = cpu_to_le16(length); | 270 | tptr->descCRCLength = cpu_to_le16(length); |
| 273 | tptr->descCRC = cpu_to_le16(udf_crc(data + sizeof(tag), length, 0)); | 271 | tptr->descCRC = cpu_to_le16(crc_itu_t(0, data + sizeof(tag), length)); |
| 274 | tptr->tagChecksum = udf_tag_checksum(tptr); | 272 | tptr->tagChecksum = udf_tag_checksum(tptr); |
| 275 | } | 273 | } |
| 276 | 274 | ||
