diff mbox

libceph: stop parsing when detecting bad option

Message ID 20180627130508.26451-1-cgxu519@gmx.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chengguang Xu June 27, 2018, 1:05 p.m. UTC
There is no reason to continue option parsing after detecting
bad option.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 net/ceph/ceph_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ilya Dryomov June 27, 2018, 3:58 p.m. UTC | #1
On Wed, Jun 27, 2018 at 3:05 PM Chengguang Xu <cgxu519@gmx.com> wrote:
>
> There is no reason to continue option parsing after detecting
> bad option.
>
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> ---
>  net/ceph/ceph_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
> index 584fdbef2088..a75f1640f50a 100644
> --- a/net/ceph/ceph_common.c
> +++ b/net/ceph/ceph_common.c
> @@ -398,7 +398,7 @@ ceph_parse_options(char *options, const char *dev_name,
>                         if (ret < 0) {
>                                 pr_err("bad mount option arg (not int) "
>                                        "at '%s'\n", c);
> -                               continue;
> +                               goto out;
>                         }
>                         dout("got int token %d val %d\n", token, intval);
>                 } else if (token > Opt_last_int && token < Opt_last_string) {

Applied, merging in an error handling change.  See
https://github.com/ceph/ceph-client/commit/0dab2020c9a77b5604f0506fda0062e2539791e1.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chengguang Xu June 28, 2018, 1:38 a.m. UTC | #2
On 06/27/2018 11:58 PM, Ilya Dryomov wrote:
> On Wed, Jun 27, 2018 at 3:05 PM Chengguang Xu <cgxu519@gmx.com> wrote:
>> There is no reason to continue option parsing after detecting
>> bad option.
>>
>> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
>> ---
>>   net/ceph/ceph_common.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
>> index 584fdbef2088..a75f1640f50a 100644
>> --- a/net/ceph/ceph_common.c
>> +++ b/net/ceph/ceph_common.c
>> @@ -398,7 +398,7 @@ ceph_parse_options(char *options, const char *dev_name,
>>                          if (ret < 0) {
>>                                  pr_err("bad mount option arg (not int) "
>>                                         "at '%s'\n", c);
>> -                               continue;
>> +                               goto out;
>>                          }
>>                          dout("got int token %d val %d\n", token, intval);
>>                  } else if (token > Opt_last_int && token < Opt_last_string) {
> Applied, merging in an error handling change.  See
> https://github.com/ceph/ceph-client/commit/0dab2020c9a77b5604f0506fda0062e2539791e1.

Looks good to me, thanks.

Chengguang.
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 584fdbef2088..a75f1640f50a 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -398,7 +398,7 @@  ceph_parse_options(char *options, const char *dev_name,
 			if (ret < 0) {
 				pr_err("bad mount option arg (not int) "
 				       "at '%s'\n", c);
-				continue;
+				goto out;
 			}
 			dout("got int token %d val %d\n", token, intval);
 		} else if (token > Opt_last_int && token < Opt_last_string) {