All of lore.kernel.org
 help / color / mirror / Atom feed
* master - cmdline: ensure command struct is defined
@ 2017-04-12 19:38 Zdenek Kabelac
  0 siblings, 0 replies; only message in thread
From: Zdenek Kabelac @ 2017-04-12 19:38 UTC (permalink / raw)
  To: lvm-devel

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3503ef23e30da87f16b881248be92842a774d7d9
Commit:        3503ef23e30da87f16b881248be92842a774d7d9
Parent:        635e7e0c928aba62f7d6ddf892978ece6217b905
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Sat Apr 1 12:17:16 2017 +0200
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Wed Apr 12 21:33:47 2017 +0200

cmdline: ensure command struct is defined

Make it clear to Coverity cmd will be defined.
---
 tools/lvmcmdline.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 4d20d08..4f66f7e 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1832,7 +1832,7 @@ static void _short_usage(const char *name)
 static int _usage(const char *name, int longhelp, int skip_notes)
 {
 	struct command_name *cname = find_command_name(name);
-	struct command *cmd;
+	struct command *cmd = NULL;
 	int show_full = longhelp;
 	int i;
 
@@ -1876,6 +1876,11 @@ static int _usage(const char *name, int longhelp, int skip_notes)
 	}
 
 	/* Common options are printed once for all variants of a command name. */
+	if (!cmd) {
+		log_error(INTERNAL_ERROR "Command %s not found.", name);
+		return 0;
+	}
+
 	print_usage_common_cmd(cname, cmd);
 	print_usage_common_lvm(cname, cmd);
 



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-12 19:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-12 19:38 master - cmdline: ensure command struct is defined Zdenek Kabelac

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.