From 243cd3fd2ca377d93fd7407f2a0109a04a189cbc Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 21 Jun 2012 13:52:19 +0200 Subject: cleanup: format1 test whether PV was found Avoid dereferecing NULL pointer. --- lib/format1/import-extents.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/format1/import-extents.c b/lib/format1/import-extents.c index 46c1b7b7..f0f4f657 100644 --- a/lib/format1/import-extents.c +++ b/lib/format1/import-extents.c @@ -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 */ -- cgit