Skip to contentSkip to conversation

master - cleanup: format1 test whether PV was found

PATCH Zdenek Kabelac 1 participant 1 message Aug 23, 2012

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=243cd3fd2ca377d93fd7407f2a0109a04a189cbc
Commit:        243cd3fd2ca377d93fd7407f2a0109a04a189cbc
Parent:        132306c8887ac7279edd515a9f5c5de75dfc463a
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Thu Jun 21 13:52:19 2012 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Thu Aug 23 14:37:52 2012 +0200

cleanup: format1 test whether PV was found

Avoid dereferecing NULL pointer.

---
 lib/format1/import-extents.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
lib/format1/import-extents.c +4 -1
index 46c1b7b..f0f4f65 100644
@@ -118,7 +118,10 @@ static int _fill_maps(struct dm_hash_table *maps, struct volume_group *vg,
 	uint32_t i, lv_num, le;
 
 	dm_list_iterate_items(dl, pvds) {
-		pv = find_pv(vg, dl->dev);
+		if (!(pv = find_pv(vg, dl->dev))) {
+			log_error("PV %s not found.", dl->dev->pvid);
+			return 0;
+		}
 		e = dl->extents;
 
 		/* build an array of lv's for this pv */