summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2015-01-22 10:11:19 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2015-01-22 10:11:19 +0100
commit0fddc5ab5c892d02fd097828de36ee033dc1e7b3 (patch)
tree065d9d53e6173d50eca732ccc1bd061bb2648685 /lib
parente0dc3d5efb6da6d45994f88e9d89e6657a183aac (diff)
downloadlvm2-0fddc5ab5c892d02fd097828de36ee033dc1e7b3.tar.gz
coverity: missing return value check
Reported by coverity for code added recently - _avoid_pvs_with_other_images_of_lv which calls process_each_sub_lv and not checking return value.
Diffstat (limited to 'lib')
-rw-r--r--lib/metadata/raid_manip.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index d50237926..5c2ca95ae 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1563,9 +1563,9 @@ static int _avoid_pvs_of_lv(struct logical_volume *lv, void *data)
* by setting the internal PV_ALLOCATION_PROHIBITED flag to use it to avoid generating
* pv maps for those PVs.
*/
-static void _avoid_pvs_with_other_images_of_lv(struct logical_volume *lv, struct dm_list *allocate_pvs)
+static int _avoid_pvs_with_other_images_of_lv(struct logical_volume *lv, struct dm_list *allocate_pvs)
{
- for_each_sub_lv(lv, _avoid_pvs_of_lv, allocate_pvs);
+ return for_each_sub_lv(lv, _avoid_pvs_of_lv, allocate_pvs);
}
/*
@@ -1667,7 +1667,11 @@ int lv_raid_replace(struct logical_volume *lv,
}
/* Prevent any PVs holding image components from being used for allocation */
- _avoid_pvs_with_other_images_of_lv(lv, allocate_pvs);
+ if (!_avoid_pvs_with_other_images_of_lv(lv, allocate_pvs)) {
+ log_error("Failed to prevent PVs holding image components "
+ "from being used for allocation.");
+ return 0;
+ }
/*
* Allocate the new image components first