[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1525340676-34072-1-git-send-email-cgxu519@gmx.com>
Date: Thu, 3 May 2018 17:44:35 +0800
From: Chengguang Xu <cgxu519@....com>
To: akpm@...ux-foundation.org, ericvh@...il.com, rminnich@...dia.gov,
lucho@...kov.net
Cc: v9fs-developer@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
Chengguang Xu <cgxu519@....com>
Subject: [V9fs-developer][PATCH v3 1/2] net/9p: detecting invalid options as much as possible
Currently when detecting invalid options in option parsing,
some options(e.g. msize) just set errno and allow to continuously
validate other options so that it can detect invalid options
as much as possible and give proper error messages together.
This patch applies same rule to option 'trans' and 'version'
when detecting -EINVAL.
Signed-off-by: Chengguang Xu <cgxu519@....com>
---
Changes since v2:
- Introduce a new temporary variable to avoid overriding error code.
Changes since v1:
- Do not change behavior when detecting ENOMEM or unrecognized options.
net/9p/client.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/net/9p/client.c b/net/9p/client.c
index 21e6df1..18c5271 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -198,8 +198,6 @@ static int parse_opts(char *opts, struct p9_client *clnt)
pr_info("Could not find request transport: %s\n",
s);
ret = -EINVAL;
- kfree(s);
- goto free_and_return;
}
kfree(s);
break;
@@ -214,13 +212,12 @@ static int parse_opts(char *opts, struct p9_client *clnt)
"problem allocating copy of version arg\n");
goto free_and_return;
}
- ret = get_protocol_version(s);
- if (ret == -EINVAL) {
- kfree(s);
- goto free_and_return;
- }
+ r = get_protocol_version(s);
+ if (r < 0)
+ ret = r;
+ else
+ clnt->proto_version = r;
kfree(s);
- clnt->proto_version = ret;
break;
default:
continue;
--
1.8.3.1
Powered by blists - more mailing lists