2013-08-23 02:47:52

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] block: fix error return code in parse_parts()

From: Wei Yongjun <[email protected]>

Fix to return -EINVAL in the parts parse error handling case instead
of 0(may overwrite to 0 by parse_subpart()), as done elsewhere in this
function.

Signed-off-by: Wei Yongjun <[email protected]>
---
block/cmdline-parser.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/block/cmdline-parser.c b/block/cmdline-parser.c
index 18fb435..cc2637f 100644
--- a/block/cmdline-parser.c
+++ b/block/cmdline-parser.c
@@ -135,6 +135,7 @@ static int parse_parts(struct cmdline_parts **parts, const char *bdevdef)

if (!newparts->subpart) {
pr_warn("cmdline partition has no valid partition.");
+ ret = -EINVAL;
goto fail;
}


2013-08-23 04:58:15

by Caizhiyong

[permalink] [raw]
Subject: RE: [PATCH -next] block: fix error return code in parse_parts()

> From: Wei Yongjun [mailto:[email protected]]
> Sent: Friday, August 23, 2013 10:48 AM
> To: [email protected]; [email protected]; Caizhiyong; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]
> Cc: [email protected]; [email protected]
> Subject: [PATCH -next] block: fix error return code in parse_parts()
>
> From: Wei Yongjun <[email protected]>
>
> Fix to return -EINVAL in the parts parse error handling case instead
> of 0(may overwrite to 0 by parse_subpart()), as done elsewhere in this
> function.
>
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> block/cmdline-parser.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/block/cmdline-parser.c b/block/cmdline-parser.c
> index 18fb435..cc2637f 100644
> --- a/block/cmdline-parser.c
> +++ b/block/cmdline-parser.c
> @@ -135,6 +135,7 @@ static int parse_parts(struct cmdline_parts **parts, const char
> *bdevdef)
>
> if (!newparts->subpart) {
> pr_warn("cmdline partition has no valid partition.");
> + ret = -EINVAL;

Seems OK to me.

> goto fail;
> }
>

2013-08-23 05:01:46

by Caizhiyong

[permalink] [raw]
Subject: RE: [PATCH -next] block: fix error return code in parse_parts()

> -----Original Message-----
> From: Wei Yongjun [mailto:[email protected]]
> Sent: Friday, August 23, 2013 10:48 AM
> To: [email protected]; [email protected]; Caizhiyong; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]
> Cc: [email protected]; [email protected]
> Subject: [PATCH -next] block: fix error return code in parse_parts()
>
> From: Wei Yongjun <[email protected]>
>
> Fix to return -EINVAL in the parts parse error handling case instead
> of 0(may overwrite to 0 by parse_subpart()), as done elsewhere in this
> function.
>
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> block/cmdline-parser.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/block/cmdline-parser.c b/block/cmdline-parser.c
> index 18fb435..cc2637f 100644
> --- a/block/cmdline-parser.c
> +++ b/block/cmdline-parser.c
> @@ -135,6 +135,7 @@ static int parse_parts(struct cmdline_parts **parts, const char
> *bdevdef)
>
> if (!newparts->subpart) {
> pr_warn("cmdline partition has no valid partition.");
> + ret = -EINVAL;


Seems OK to me.

> goto fail;
> }
>