From f331eb1c0d060529a3b5e6517c8ac423e21796d3 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sat, 17 Mar 2018 14:16:09 +0100 Subject: [PATCH] coverity: ensure lock_type is not NULL --- tools/vgchange.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/vgchange.c b/tools/vgchange.c index 6d739fe9b..7cfaab6a1 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -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; } -- 2.43.5