From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] xfs_io: fix null pointer deref when complaining about scrub command
Date: Tue, 29 May 2018 20:32:15 -0700 [thread overview]
Message-ID: <20180530033215.GO30110@magnolia> (raw)
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:
next reply other threads:[~2018-05-30 3:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-30 3:32 Darrick J. Wong [this message]
2018-05-31 14:52 ` [PATCH] xfs_io: fix null pointer deref when complaining about scrub command Eric Sandeen
2018-05-31 14:55 ` Bill O'Donnell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180530033215.GO30110@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).