diff options
-rw-r--r-- | fs/udf/dir.c | 2 | ||||
-rw-r--r-- | fs/udf/namei.c | 2 | ||||
-rw-r--r-- | fs/udf/symlink.c | 3 | ||||
-rw-r--r-- | fs/udf/unicode.c | 12 |
4 files changed, 12 insertions, 7 deletions
diff --git a/fs/udf/dir.c b/fs/udf/dir.c index 541a12b5792d..fcf227eb2c51 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c | |||
@@ -168,7 +168,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | flen = udf_get_filename(sb, nameptr, lfi, fname, UDF_NAME_LEN); | 170 | flen = udf_get_filename(sb, nameptr, lfi, fname, UDF_NAME_LEN); |
171 | if (!flen) | 171 | if (flen <= 0) |
172 | continue; | 172 | continue; |
173 | 173 | ||
174 | tloc = lelb_to_cpu(cfi.icb.extLocation); | 174 | tloc = lelb_to_cpu(cfi.icb.extLocation); |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 5c03f0dfb98b..51b1c31b55c8 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -234,7 +234,7 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, | |||
234 | continue; | 234 | continue; |
235 | 235 | ||
236 | flen = udf_get_filename(sb, nameptr, lfi, fname, UDF_NAME_LEN); | 236 | flen = udf_get_filename(sb, nameptr, lfi, fname, UDF_NAME_LEN); |
237 | if (flen && udf_match(flen, fname, child->len, child->name)) | 237 | if (flen > 0 && udf_match(flen, fname, child->len, child->name)) |
238 | goto out_ok; | 238 | goto out_ok; |
239 | } | 239 | } |
240 | 240 | ||
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c index 8dfbc4025e2f..862535b3ba58 100644 --- a/fs/udf/symlink.c +++ b/fs/udf/symlink.c | |||
@@ -82,6 +82,9 @@ static int udf_pc_to_char(struct super_block *sb, unsigned char *from, | |||
82 | comp_len = udf_get_filename(sb, pc->componentIdent, | 82 | comp_len = udf_get_filename(sb, pc->componentIdent, |
83 | pc->lengthComponentIdent, | 83 | pc->lengthComponentIdent, |
84 | p, tolen); | 84 | p, tolen); |
85 | if (comp_len < 0) | ||
86 | return comp_len; | ||
87 | |||
85 | p += comp_len; | 88 | p += comp_len; |
86 | tolen -= comp_len; | 89 | tolen -= comp_len; |
87 | if (tolen == 0) | 90 | if (tolen == 0) |
diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c index b84fee372734..4911c1d84882 100644 --- a/fs/udf/unicode.c +++ b/fs/udf/unicode.c | |||
@@ -338,15 +338,17 @@ int udf_get_filename(struct super_block *sb, uint8_t *sname, int slen, | |||
338 | uint8_t *dname, int dlen) | 338 | uint8_t *dname, int dlen) |
339 | { | 339 | { |
340 | struct ustr *filename, *unifilename; | 340 | struct ustr *filename, *unifilename; |
341 | int len = 0; | 341 | int ret = 0; |
342 | 342 | ||
343 | filename = kmalloc(sizeof(struct ustr), GFP_NOFS); | 343 | filename = kmalloc(sizeof(struct ustr), GFP_NOFS); |
344 | if (!filename) | 344 | if (!filename) |
345 | return 0; | 345 | return -ENOMEM; |
346 | 346 | ||
347 | unifilename = kmalloc(sizeof(struct ustr), GFP_NOFS); | 347 | unifilename = kmalloc(sizeof(struct ustr), GFP_NOFS); |
348 | if (!unifilename) | 348 | if (!unifilename) { |
349 | ret = -ENOMEM; | ||
349 | goto out1; | 350 | goto out1; |
351 | } | ||
350 | 352 | ||
351 | if (udf_build_ustr_exact(unifilename, sname, slen)) | 353 | if (udf_build_ustr_exact(unifilename, sname, slen)) |
352 | goto out2; | 354 | goto out2; |
@@ -367,14 +369,14 @@ int udf_get_filename(struct super_block *sb, uint8_t *sname, int slen, | |||
367 | } else | 369 | } else |
368 | goto out2; | 370 | goto out2; |
369 | 371 | ||
370 | len = udf_translate_to_linux(dname, dlen, | 372 | ret = udf_translate_to_linux(dname, dlen, |
371 | filename->u_name, filename->u_len, | 373 | filename->u_name, filename->u_len, |
372 | unifilename->u_name, unifilename->u_len); | 374 | unifilename->u_name, unifilename->u_len); |
373 | out2: | 375 | out2: |
374 | kfree(unifilename); | 376 | kfree(unifilename); |
375 | out1: | 377 | out1: |
376 | kfree(filename); | 378 | kfree(filename); |
377 | return len; | 379 | return ret; |
378 | } | 380 | } |
379 | 381 | ||
380 | int udf_put_filename(struct super_block *sb, const uint8_t *sname, | 382 | int udf_put_filename(struct super_block *sb, const uint8_t *sname, |