main - cov: validata top_lv

Zdenek Kabelac <[email protected]>
Newsgroups gmane.linux.lvm.devel
Message-ID <[email protected]>
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=242bf56413f67dc3dd16770d420ced06eed0c4be
Commit:        242bf56413f67dc3dd16770d420ced06eed0c4be
Parent:        fae0ed8f10bc5771423f2b7af63690800de1ce9f
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Apr 26 13:44:52 2023 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Sat May 6 19:22:05 2023 +0200

cov: validata top_lv

Add explicit pointer check is never NULL.
---
 lib/metadata/lv_manip.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 2dfa3c77b..8975bf180 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5951,6 +5951,11 @@ static void _setup_params_for_extend_metadata(struct logical_volume *lv,
 
 static int _lv_resize_check_used(struct logical_volume *lv)
 {
+	if (!lv) {
+		log_error(INTERNAL_ERROR "LV is not specified.");
+		return 0;
+	}
+
 	if (lv_is_locked(lv)) {
 		log_error("Can't resize locked logical volume %s.", display_lvname(lv));
 		return 0;

--
lvm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/lvm-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.