diff options
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r-- | fs/udf/super.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c index a522c15a0bfd..fa92fe839fda 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -887,18 +887,14 @@ static int udf_find_fileset(struct super_block *sb, | |||
887 | static int udf_load_pvoldesc(struct super_block *sb, sector_t block) | 887 | static int udf_load_pvoldesc(struct super_block *sb, sector_t block) |
888 | { | 888 | { |
889 | struct primaryVolDesc *pvoldesc; | 889 | struct primaryVolDesc *pvoldesc; |
890 | struct ustr *instr, *outstr; | 890 | uint8_t *outstr; |
891 | struct buffer_head *bh; | 891 | struct buffer_head *bh; |
892 | uint16_t ident; | 892 | uint16_t ident; |
893 | int ret = -ENOMEM; | 893 | int ret = -ENOMEM; |
894 | 894 | ||
895 | instr = kmalloc(sizeof(struct ustr), GFP_NOFS); | 895 | outstr = kmalloc(128, GFP_NOFS); |
896 | if (!instr) | ||
897 | return -ENOMEM; | ||
898 | |||
899 | outstr = kmalloc(sizeof(struct ustr), GFP_NOFS); | ||
900 | if (!outstr) | 896 | if (!outstr) |
901 | goto out1; | 897 | return -ENOMEM; |
902 | 898 | ||
903 | bh = udf_read_tagged(sb, block, block, &ident); | 899 | bh = udf_read_tagged(sb, block, block, &ident); |
904 | if (!bh) { | 900 | if (!bh) { |
@@ -923,31 +919,25 @@ static int udf_load_pvoldesc(struct super_block *sb, sector_t block) | |||
923 | #endif | 919 | #endif |
924 | } | 920 | } |
925 | 921 | ||
926 | if (!udf_build_ustr(instr, pvoldesc->volIdent, 32)) { | 922 | ret = udf_CS0toUTF8(outstr, 31, pvoldesc->volIdent, 32); |
927 | ret = udf_CS0toUTF8(outstr, instr); | 923 | if (ret < 0) |
928 | if (ret < 0) | 924 | goto out_bh; |
929 | goto out_bh; | ||
930 | 925 | ||
931 | strncpy(UDF_SB(sb)->s_volume_ident, outstr->u_name, | 926 | strncpy(UDF_SB(sb)->s_volume_ident, outstr, ret); |
932 | outstr->u_len > 31 ? 31 : outstr->u_len); | 927 | udf_debug("volIdent[] = '%s'\n", UDF_SB(sb)->s_volume_ident); |
933 | udf_debug("volIdent[] = '%s'\n", UDF_SB(sb)->s_volume_ident); | ||
934 | } | ||
935 | 928 | ||
936 | if (!udf_build_ustr(instr, pvoldesc->volSetIdent, 128)) { | 929 | ret = udf_CS0toUTF8(outstr, 127, pvoldesc->volSetIdent, 128); |
937 | ret = udf_CS0toUTF8(outstr, instr); | 930 | if (ret < 0) |
938 | if (ret < 0) | 931 | goto out_bh; |
939 | goto out_bh; | ||
940 | 932 | ||
941 | udf_debug("volSetIdent[] = '%s'\n", outstr->u_name); | 933 | outstr[ret] = 0; |
942 | } | 934 | udf_debug("volSetIdent[] = '%s'\n", outstr); |
943 | 935 | ||
944 | ret = 0; | 936 | ret = 0; |
945 | out_bh: | 937 | out_bh: |
946 | brelse(bh); | 938 | brelse(bh); |
947 | out2: | 939 | out2: |
948 | kfree(outstr); | 940 | kfree(outstr); |
949 | out1: | ||
950 | kfree(instr); | ||
951 | return ret; | 941 | return ret; |
952 | } | 942 | } |
953 | 943 | ||
@@ -2358,7 +2348,7 @@ static int udf_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
2358 | le32_to_cpu(lvidiu->numDirs)) : 0) | 2348 | le32_to_cpu(lvidiu->numDirs)) : 0) |
2359 | + buf->f_bfree; | 2349 | + buf->f_bfree; |
2360 | buf->f_ffree = buf->f_bfree; | 2350 | buf->f_ffree = buf->f_bfree; |
2361 | buf->f_namelen = UDF_NAME_LEN - 2; | 2351 | buf->f_namelen = UDF_NAME_LEN; |
2362 | buf->f_fsid.val[0] = (u32)id; | 2352 | buf->f_fsid.val[0] = (u32)id; |
2363 | buf->f_fsid.val[1] = (u32)(id >> 32); | 2353 | buf->f_fsid.val[1] = (u32)(id >> 32); |
2364 | 2354 | ||