summaryrefslogtreecommitdiff
path: root/fs/udf/unicode.c
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2015-04-08 21:23:54 +0200
committerJan Kara <jack@suse.cz>2015-05-18 11:23:05 +0200
commite9d4cf411f7582537ed0038d0f32a8743b75e58a (patch)
treecce973fd1e174661934c3d691ac0280e231c7907 /fs/udf/unicode.c
parentd67e4a481425106a43c8d3cef82a82cc31b4edd8 (diff)
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/unicode.c')
-rw-r--r--fs/udf/unicode.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
index 41c3bef1d226..35cc9477b066 100644
--- a/fs/udf/unicode.c
+++ b/fs/udf/unicode.c
@@ -89,7 +89,7 @@ static void udf_build_ustr_exact(struct ustr *dest, dstring *ptr, int exactsize)
* both of type "struct ustr *"
*
* POST-CONDITIONS
- * <return> Zero on success.
+ * <return> >= 0 on success.
*
* HISTORY
* November 12, 1997 - Andrew E. Mileski
@@ -112,7 +112,7 @@ int udf_CS0toUTF8(struct ustr *utf_o, const struct ustr *ocu_i)
memset(utf_o, 0, sizeof(struct ustr));
pr_err("unknown compression code (%d) stri=%s\n",
cmp_id, ocu_i->u_name);
- return 0;
+ return -EINVAL;
}
ocu = ocu_i->u_name;
@@ -350,7 +350,8 @@ int udf_get_filename(struct super_block *sb, uint8_t *sname, int slen,
udf_build_ustr_exact(unifilename, sname, slen);
if (UDF_QUERY_FLAG(sb, UDF_FLAG_UTF8)) {
- if (!udf_CS0toUTF8(filename, unifilename)) {
+ ret = udf_CS0toUTF8(filename, unifilename);
+ if (ret < 0) {
udf_debug("Failed in udf_get_filename: sname = %s\n",
sname);
goto out2;