From e0a6073efc9bedc92db21007d08b1cf1dbae0e35 Mon Sep 17 00:00:00 2001 From: workingwei Date: Tue, 11 Nov 2025 16:12:57 +0800 Subject: [PATCH] add internal error for missing vg --- 0039-add-internal-error-for-missing-vg.patch | 38 ++++++++++++++++++++ lvm2.spec | 6 +++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0039-add-internal-error-for-missing-vg.patch diff --git a/0039-add-internal-error-for-missing-vg.patch b/0039-add-internal-error-for-missing-vg.patch new file mode 100644 index 0000000..7dc2d8d --- /dev/null +++ b/0039-add-internal-error-for-missing-vg.patch @@ -0,0 +1,38 @@ +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 +@@ -620,6 +620,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; + +@@ -746,6 +751,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))) { diff --git a/lvm2.spec b/lvm2.spec index acf7ce5..2aa1314 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -43,7 +43,7 @@ Name: lvm2 Version: 2.03.14 -Release: 20 +Release: 21 Epoch: 8 Summary: Tools for logical volume management License: GPLv2+ and LGPLv2.1 and BSD @@ -87,6 +87,7 @@ Patch35: 0035-fix-function-undeclared-in-libdm-common.c-and-dev-cache.c.patch Patch36: 0036-config-check-for-0-from-read.patch Patch37: 0037-fix-pv_major-and-pv_minor-report-field-type.patch Patch38: 0038-fix-buffer-size-usage.patch +Patch39: 0039-add-internal-error-for-missing-vg.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -513,6 +514,9 @@ fi %changelog +* Tue Nov 11 2025 weishuaihao - 8:2.03.14-21 +- Add internal error for missing vg + * Tue Nov 4 2025 weishuaihao - 8:2.03.14-20 - fix buffer size usage -- Gitee