[lvm-devel] master - cleanup: ensuring string is not NULL

Zdenek Kabelac zkabelac at fedoraproject.org
Mon Nov 9 16:06:03 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=45e749493c55ec349abfe9670cb46c6a70528ae4
Commit:        45e749493c55ec349abfe9670cb46c6a70528ae4
Parent:        76b42901c08bd66df600f3ad82fc2f179a3abc8a
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Mon Nov 9 16:58:24 2015 +0100
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Mon Nov 9 17:04:10 2015 +0100

cleanup: ensuring string is not NULL

Coverity cannot see the string cannot be NULL so make it explicit.
---
 lib/commands/toolcontext.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index c150991..a2f21b8 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -561,9 +561,9 @@ static int _process_config(struct cmd_context *cmd)
 #endif
 
 	dev_ext_info_src = find_config_tree_str(cmd, devices_external_device_info_source_CFG, NULL);
-	if (!strcmp(dev_ext_info_src, "none"))
+	if (dev_ext_info_src && !strcmp(dev_ext_info_src, "none"))
 		init_external_device_info_source(DEV_EXT_NONE);
-	else if (!strcmp(dev_ext_info_src, "udev"))
+	else if (dev_ext_info_src && !strcmp(dev_ext_info_src, "udev"))
 		init_external_device_info_source(DEV_EXT_UDEV);
 	else {
 		log_error("Invalid external device info source specification.");




More information about the lvm-devel mailing list