From 57ab219d9b2eea107b59b2fb7ef3bd114ca29b72 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 25 Apr 2024 23:51:58 +0200 Subject: [PATCH] cov: validation Add internal error for missing vg. --- tools/pvmove.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/pvmove.c b/tools/pvmove.c index dd68e33d1..c5f9d545e 100644 --- a/tools/pvmove.c +++ b/tools/pvmove.c @@ -627,6 +627,11 @@ static int _pvmove_setup_single(struct cmd_context *cmd, unsigned exclusive; int r = ECMD_FAILED; + if (!vg) { + log_error(INTERNAL_ERROR "Missing volume group."); + return r; + } + pp->found_pv = 1; pp->setup_result = ECMD_FAILED; @@ -761,6 +766,11 @@ static int _pvmove_read_single(struct cmd_context *cmd, struct logical_volume *lv; int ret = ECMD_FAILED; + if (!vg) { + log_error(INTERNAL_ERROR "Missing volume group."); + return ret; + } + pp->found_pv = 1; if (!(lv = find_pvmove_lv(vg, pv_dev(pv), PVMOVE))) {