diff options
author | Fabian Frederick <fabf@skynet.be> | 2015-04-08 21:23:54 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2015-05-18 11:23:05 +0200 |
commit | e9d4cf411f7582537ed0038d0f32a8743b75e58a (patch) | |
tree | cce973fd1e174661934c3d691ac0280e231c7907 /fs/udf/super.c | |
parent | d67e4a481425106a43c8d3cef82a82cc31b4edd8 (diff) | |
download | linux-e9d4cf411f7582537ed0038d0f32a8743b75e58a.tar.gz linux-e9d4cf411f7582537ed0038d0f32a8743b75e58a.tar.bz2 linux-e9d4cf411f7582537ed0038d0f32a8743b75e58a.zip |
udf: improve error management in udf_CS0toUTF8()
udf_CS0toUTF8() now returns -EINVAL on error.
udf_load_pvoldesc() and udf_get_filename() do the same.
Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r-- | fs/udf/super.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c index 6299f341967b..c6a8f5f79443 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -927,17 +927,22 @@ static int udf_load_pvoldesc(struct super_block *sb, sector_t block) #endif } - if (!udf_build_ustr(instr, pvoldesc->volIdent, 32)) - if (udf_CS0toUTF8(outstr, instr)) { - strncpy(UDF_SB(sb)->s_volume_ident, outstr->u_name, - outstr->u_len > 31 ? 31 : outstr->u_len); - udf_debug("volIdent[] = '%s'\n", - UDF_SB(sb)->s_volume_ident); - } + if (!udf_build_ustr(instr, pvoldesc->volIdent, 32)) { + ret = udf_CS0toUTF8(outstr, instr); + if (ret < 0) + goto out_bh; + + strncpy(UDF_SB(sb)->s_volume_ident, outstr->u_name, + outstr->u_len > 31 ? 31 : outstr->u_len); + udf_debug("volIdent[] = '%s'\n", UDF_SB(sb)->s_volume_ident); + } if (!udf_build_ustr(instr, pvoldesc->volSetIdent, 128)) - if (udf_CS0toUTF8(outstr, instr)) - udf_debug("volSetIdent[] = '%s'\n", outstr->u_name); + ret = udf_CS0toUTF8(outstr, instr); + if (ret < 0) + goto out_bh; + + udf_debug("volSetIdent[] = '%s'\n", outstr->u_name); ret = 0; out_bh: |