Skip to contentSkip to conversation

master - integrity: fix segfault for lv with no seg

PATCH David Teigland 1 participant 1 message Sep 2, 2020

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9a7b81fb7262dbd896b74bc76a98f070a9309fed
Commit:        9a7b81fb7262dbd896b74bc76a98f070a9309fed
Parent:        739827ef1c1a256114aa0b2a385baa0983fac289
Author:        David Teigland <[email protected]>
AuthorDate:    Wed Sep 2 09:15:58 2020 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Sep 2 09:15:58 2020 -0500

integrity: fix segfault for lv with no seg

in lv_raid_has_integrity

---
 lib/metadata/integrity_manip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/metadata/integrity_manip.c +2 -1
index 6b2d352a7..5854a2a52 100644
@@ -847,7 +847,8 @@ int lv_raid_has_integrity(struct logical_volume *lv)
 	struct lv_segment *seg, *seg_image;
 	uint32_t s;
 
-	seg = first_seg(lv);
+	if (!(seg = first_seg(lv)))
+		return 0;
 
 	if (seg_is_raid(seg)) {
 		for (s = 0; s < seg->area_count; s++) {