summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2015-04-08 21:23:52 +0200
committerJan Kara <jack@suse.cz>2015-05-18 11:23:04 +0200
commit31f2566f33a6a25ac0baf402316e37e76632445f (patch)
tree5d5c915502320c16ae6f7ea02233816ddbbb7ead /fs
parent5ceb8b554dcaaf6844415cd2616ce2e0132530fa (diff)
downloadlinux-31f2566f33a6a25ac0baf402316e37e76632445f.tar.bz2
udf: remove unnecessary test in udf_build_ustr_exact()
We can remove parameter checks: udf_build_ustr_exact() is only called by udf_get_filename() which now assures dest is not NULL udf_find_entry() and udf_readdir() call udf_get_filename() after checking sname udf_symlink_filler() calls udf_pc_to_char() with sname=kmap(page). udf_find_entry() and udf_readdir() call udf_get_filename with UDF_NAME_LEN udf_pc_to_char() with PAGE_SIZE 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')
-rw-r--r--fs/udf/unicode.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
index 4911c1d84882..e2c079aae7c0 100644
--- a/fs/udf/unicode.c
+++ b/fs/udf/unicode.c
@@ -68,17 +68,12 @@ int udf_build_ustr(struct ustr *dest, dstring *ptr, int size)
/*
* udf_build_ustr_exact
*/
-static int udf_build_ustr_exact(struct ustr *dest, dstring *ptr, int exactsize)
+static void udf_build_ustr_exact(struct ustr *dest, dstring *ptr, int exactsize)
{
- if ((!dest) || (!ptr) || (!exactsize))
- return -1;
-
memset(dest, 0, sizeof(struct ustr));
dest->u_cmpID = ptr[0];
dest->u_len = exactsize - 1;
memcpy(dest->u_name, ptr + 1, exactsize - 1);
-
- return 0;
}
/*
@@ -340,6 +335,9 @@ int udf_get_filename(struct super_block *sb, uint8_t *sname, int slen,
struct ustr *filename, *unifilename;
int ret = 0;
+ if (!slen)
+ return -EIO;
+
filename = kmalloc(sizeof(struct ustr), GFP_NOFS);
if (!filename)
return -ENOMEM;
@@ -350,9 +348,7 @@ int udf_get_filename(struct super_block *sb, uint8_t *sname, int slen,
goto out1;
}
- if (udf_build_ustr_exact(unifilename, sname, slen))
- goto out2;
-
+ udf_build_ustr_exact(unifilename, sname, slen);
if (UDF_QUERY_FLAG(sb, UDF_FLAG_UTF8)) {
if (!udf_CS0toUTF8(filename, unifilename)) {
udf_debug("Failed in udf_get_filename: sname = %s\n",