Skip to contentSkip to conversation

master - coverity: ensure lock_type is not NULL

PATCH Zdenek Kabelac 1 participant 1 message Mar 17, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f331eb1c0d060529a3b5e6517c8ac423e21796d3
Commit:        f331eb1c0d060529a3b5e6517c8ac423e21796d3
Parent:        fd6661dfcf7568d32a127e63b0d6c95c010688fb
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sat Mar 17 14:16:09 2018 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Sat Mar 17 23:33:58 2018 +0100

coverity: ensure lock_type is not NULL

---
 tools/vgchange.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/vgchange.c +2 -2
index 6d739fe..7cfaab6 100644
@@ -955,7 +955,7 @@ static int _vgchange_locktype(struct cmd_context *cmd, struct volume_group *vg)
 			vg->lock_type = "none";
 	}
 
-	if (!strcmp(vg->lock_type, lock_type)) {
+	if (lock_type && !strcmp(vg->lock_type, lock_type)) {
 		log_warn("New lock type %s matches the current lock type %s.",
 			 lock_type, vg->lock_type);
 		return 1;
@@ -1180,7 +1180,7 @@ int vgchange_locktype_cmd(struct cmd_context *cmd, int argc, char **argv)
 	 * just return success when they see the disable flag set.
 	 */
 	if (lockopt && !strcmp(lockopt, "force")) {
-		if (strcmp(lock_type, "none")) {
+		if (lock_type && strcmp(lock_type, "none")) {
 			log_error("Lock type can only be forced to \"none\" for recovery.");
 			return 0;
 		}