1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Peter Rajnoha 2015-01-22 10:11:19 +01:00
parent e0dc3d5efb
commit 0fddc5ab5c

View File

@ -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