All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_io: fix null pointer deref when complaining about scrub command
@ 2018-05-30  3:32 Darrick J. Wong
  2018-05-31 14:52 ` Eric Sandeen
  2018-05-31 14:55 ` Bill O'Donnell
  0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2018-05-30  3:32 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs

From: Darrick J. Wong <darrick.wong@oracle.com>

Don't increment optind until we've validated that argv[optind] is a
valid scrub/repair subcommand and do not need to complain about
argv[optind].

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 io/scrub.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/io/scrub.c b/io/scrub.c
index 604daed9..37ffe46b 100644
--- a/io/scrub.c
+++ b/io/scrub.c
@@ -166,12 +166,11 @@ parse_args(
 			break;
 		}
 	}
-	optind++;
-
 	if (type < 0) {
 		printf(_("Unknown type '%s'.\n"), argv[optind]);
 		return command_usage(cmdinfo);
 	}
+	optind++;
 
 	switch (d->type) {
 	case ST_INODE:

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_io: fix null pointer deref when complaining about scrub command
  2018-05-30  3:32 [PATCH] xfs_io: fix null pointer deref when complaining about scrub command Darrick J. Wong
@ 2018-05-31 14:52 ` Eric Sandeen
  2018-05-31 14:55 ` Bill O'Donnell
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2018-05-31 14:52 UTC (permalink / raw)
  To: Darrick J. Wong, Eric Sandeen; +Cc: xfs

On 5/29/18 10:32 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Don't increment optind until we've validated that argv[optind] is a
> valid scrub/repair subcommand and do not need to complain about
> argv[optind].
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>


> ---
>   io/scrub.c |    3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/io/scrub.c b/io/scrub.c
> index 604daed9..37ffe46b 100644
> --- a/io/scrub.c
> +++ b/io/scrub.c
> @@ -166,12 +166,11 @@ parse_args(
>   			break;
>   		}
>   	}
> -	optind++;
> -
>   	if (type < 0) {
>   		printf(_("Unknown type '%s'.\n"), argv[optind]);
>   		return command_usage(cmdinfo);
>   	}
> +	optind++;
>   
>   	switch (d->type) {
>   	case ST_INODE:

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_io: fix null pointer deref when complaining about scrub command
  2018-05-30  3:32 [PATCH] xfs_io: fix null pointer deref when complaining about scrub command Darrick J. Wong
  2018-05-31 14:52 ` Eric Sandeen
@ 2018-05-31 14:55 ` Bill O'Donnell
  1 sibling, 0 replies; 3+ messages in thread
From: Bill O'Donnell @ 2018-05-31 14:55 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eric Sandeen, xfs

On Tue, May 29, 2018 at 08:32:15PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Don't increment optind until we've validated that argv[optind] is a
> valid scrub/repair subcommand and do not need to complain about
> argv[optind].
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
>  io/scrub.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/io/scrub.c b/io/scrub.c
> index 604daed9..37ffe46b 100644
> --- a/io/scrub.c
> +++ b/io/scrub.c
> @@ -166,12 +166,11 @@ parse_args(
>  			break;
>  		}
>  	}
> -	optind++;
> -
>  	if (type < 0) {
>  		printf(_("Unknown type '%s'.\n"), argv[optind]);
>  		return command_usage(cmdinfo);
>  	}
> +	optind++;
>  
>  	switch (d->type) {
>  	case ST_INODE:
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-31 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-30  3:32 [PATCH] xfs_io: fix null pointer deref when complaining about scrub command Darrick J. Wong
2018-05-31 14:52 ` Eric Sandeen
2018-05-31 14:55 ` Bill O'Donnell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.