From 08c29873bf9194f0559aabd310d7ebbe4a55336f Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 9 Jul 2013 21:33:12 +0000 Subject: [PATCH] Ensure controller or namespace node name is specified before trying to access it. While here, also fix the identify usage message to show the -v and -x parameters. Sponsored by: Intel MFC after: 3 days --- sbin/nvmecontrol/identify.c | 4 ++++ sbin/nvmecontrol/nvmecontrol.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/identify.c b/sbin/nvmecontrol/identify.c index ab6b85f516e7..7cc499c031e6 100644 --- a/sbin/nvmecontrol/identify.c +++ b/sbin/nvmecontrol/identify.c @@ -259,6 +259,10 @@ identify(int argc, char *argv[]) while (getopt(argc, argv, "vx") != -1) ; + /* Check that a controller or namespace was specified. */ + if (optind >= argc) + identify_usage(); + target = argv[optind]; optreset = 1; diff --git a/sbin/nvmecontrol/nvmecontrol.h b/sbin/nvmecontrol/nvmecontrol.h index 99075f62e58c..8401dd7ccda3 100644 --- a/sbin/nvmecontrol/nvmecontrol.h +++ b/sbin/nvmecontrol/nvmecontrol.h @@ -38,7 +38,7 @@ " nvmecontrol devlist\n" #define IDENTIFY_USAGE \ -" nvmecontrol identify \n" +" nvmecontrol identify [-x [-v]] \n" #define PERFTEST_USAGE \ " nvmecontrol perftest <-n num_threads> <-o read|write>\n" \