[PATCH] xfs_io: fix null pointer deref when complaining about scrub command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux