lkml.org 
[lkml]   [2015]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH V2 5/9 linux-next] udf: improve error management in udf_CS0toNLS()
On Thu 09-04-15 10:37:42, Jan Kara wrote:
> On Wed 08-04-15 21:23:55, Fabian Frederick wrote:
> > Only callsite udf_get_filename() now returns
> > error code as well.
> Did same modification as in the previous patch. Otherwise OK, so I've
> merged the patch.
The resulting patch is attached for reference.

Honza

> > Suggested-by: Jan Kara <jack@suse.cz>
> > Signed-off-by: Fabian Frederick <fabf@skynet.be>
> > ---
> > fs/udf/unicode.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
> > index 9008a36..488a838 100644
> > --- a/fs/udf/unicode.c
> > +++ b/fs/udf/unicode.c
> > @@ -257,7 +257,7 @@ static int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o,
> > ocu_len = ocu_i->u_len;
> > if (ocu_len == 0) {
> > memset(utf_o, 0, sizeof(struct ustr));
> > - return 0;
> > + return -EINVAL;
> > }
> >
> > cmp_id = ocu_i->u_cmpID;
> > @@ -265,7 +265,7 @@ static int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o,
> > 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;
> > @@ -357,8 +357,9 @@ int udf_get_filename(struct super_block *sb, uint8_t *sname, int slen,
> > goto out2;
> > }
> > } else if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) {
> > - if (!udf_CS0toNLS(UDF_SB(sb)->s_nls_map, filename,
> > - unifilename)) {
> > + ret = udf_CS0toNLS(UDF_SB(sb)->s_nls_map, filename,
> > + unifilename);
> > + if (ret < 0) {
> > udf_debug("Failed in udf_get_filename: sname = %s\n",
> > sname);
> > goto out2;
> > --
> > 1.9.1
> >
> --
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
From 2cd813297b6cb07d189057402f70100fa15a826b Mon Sep 17 00:00:00 2001
From: Fabian Frederick <fabf@skynet.be>
Date: Wed, 8 Apr 2015 21:23:55 +0200
Subject: [PATCH 5/8] udf: improve error management in udf_CS0toNLS()

Only callsite udf_get_filename() now returns error code as well.

Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/udf/unicode.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
index 35cc9477b066..658aa14cc474 100644
--- a/fs/udf/unicode.c
+++ b/fs/udf/unicode.c
@@ -265,7 +265,7 @@ static int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o,
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;
@@ -357,8 +357,9 @@ int udf_get_filename(struct super_block *sb, uint8_t *sname, int slen,
goto out2;
}
} else if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) {
- if (!udf_CS0toNLS(UDF_SB(sb)->s_nls_map, filename,
- unifilename)) {
+ ret = udf_CS0toNLS(UDF_SB(sb)->s_nls_map, filename,
+ unifilename);
+ if (ret < 0) {
udf_debug("Failed in udf_get_filename: sname = %s\n",
sname);
goto out2;
--
2.1.4
\
 
 \ /
  Last update: 2015-04-09 14:21    [W:0.120 / U:8.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site