mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
coverity: Fixes for recent changes.
This commit is contained in:
parent
a497b95db1
commit
c1a66d4fc6
5
lib/cache/lvmetad.c
vendored
5
lib/cache/lvmetad.c
vendored
@ -879,7 +879,8 @@ static int _pv_populate_lvmcache(struct cmd_context *cmd,
|
|||||||
if (!id_read_format(&vgid, vgid_txt))
|
if (!id_read_format(&vgid, vgid_txt))
|
||||||
return_0;
|
return_0;
|
||||||
} else
|
} else
|
||||||
strcpy((char*)&vgid, fmt->orphan_vg_name);
|
/* NB uuid is short and NUL-terminated. */
|
||||||
|
(void) dm_strncpy((char*)&vgid, fmt->orphan_vg_name, sizeof(vgid));
|
||||||
|
|
||||||
if (!vgname)
|
if (!vgname)
|
||||||
vgname = fmt->orphan_vg_name;
|
vgname = fmt->orphan_vg_name;
|
||||||
@ -1245,7 +1246,7 @@ int lvmetad_vg_update_finish(struct volume_group *vg)
|
|||||||
dm_hash_get_first(vg->fid->metadata_areas_index) : NULL;
|
dm_hash_get_first(vg->fid->metadata_areas_index) : NULL;
|
||||||
while (n) {
|
while (n) {
|
||||||
mda = dm_hash_get_data(vg->fid->metadata_areas_index, n);
|
mda = dm_hash_get_data(vg->fid->metadata_areas_index, n);
|
||||||
strcpy(mda_id, dm_hash_get_key(vg->fid->metadata_areas_index, n));
|
(void) dm_strncpy(mda_id, dm_hash_get_key(vg->fid->metadata_areas_index, n), sizeof(mda_id));
|
||||||
if ((num = strchr(mda_id, '_'))) {
|
if ((num = strchr(mda_id, '_'))) {
|
||||||
*num = 0;
|
*num = 0;
|
||||||
++num;
|
++num;
|
||||||
|
@ -1578,7 +1578,12 @@ static uint32_t _min_sublv_area_at_le(struct lv_segment *seg, uint32_t area_le)
|
|||||||
|
|
||||||
/* Find smallest segment of each of the data image LVs at offset area_le */
|
/* Find smallest segment of each of the data image LVs at offset area_le */
|
||||||
for (s = 0; s < seg->area_count; s++) {
|
for (s = 0; s < seg->area_count; s++) {
|
||||||
seg1 = find_seg_by_le(seg_lv(seg, s), area_le);
|
if (!(seg1 = find_seg_by_le(seg_lv(seg, s), area_le))) {
|
||||||
|
log_error("Failed to find segment for %s extent %" PRIu32,
|
||||||
|
seg_lv(seg, s)->name, area_le);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
area_len = min(area_len, seg1->len);
|
area_len = min(area_len, seg1->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1734,7 +1739,8 @@ static int _raid0_to_striped_retrieve_segments_and_lvs(struct logical_volume *lv
|
|||||||
*/
|
*/
|
||||||
area_le = le = 0;
|
area_le = le = 0;
|
||||||
while (le < lv->le_count) {
|
while (le < lv->le_count) {
|
||||||
area_len = _min_sublv_area_at_le(seg, area_le);
|
if (!(area_len = _min_sublv_area_at_le(seg, area_le)))
|
||||||
|
return_0;
|
||||||
area_le += area_len;
|
area_le += area_len;
|
||||||
|
|
||||||
if (!_split_area_lvs_segments(seg, area_le) ||
|
if (!_split_area_lvs_segments(seg, area_le) ||
|
||||||
@ -1748,7 +1754,11 @@ static int _raid0_to_striped_retrieve_segments_and_lvs(struct logical_volume *lv
|
|||||||
area_le = 0;
|
area_le = 0;
|
||||||
dm_list_iterate_items(seg_to, &new_segments) {
|
dm_list_iterate_items(seg_to, &new_segments) {
|
||||||
for (s = 0; s < seg->area_count; s++) {
|
for (s = 0; s < seg->area_count; s++) {
|
||||||
data_seg = find_seg_by_le(seg_lv(seg, s), area_le);
|
if (!(data_seg = find_seg_by_le(seg_lv(seg, s), area_le))) {
|
||||||
|
log_error("Failed to find segment for %s extent %" PRIu32,
|
||||||
|
seg_lv(seg, s)->name, area_le);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Move the respective area across to our new segments area */
|
/* Move the respective area across to our new segments area */
|
||||||
if (!move_lv_segment_area(seg_to, s, data_seg, 0))
|
if (!move_lv_segment_area(seg_to, s, data_seg, 0))
|
||||||
@ -1816,10 +1826,14 @@ static int _eliminate_extracted_lvs_optional_write_vg(struct volume_group *vg,
|
|||||||
if (!_deactivate_and_remove_lvs(vg, removal_lvs))
|
if (!_deactivate_and_remove_lvs(vg, removal_lvs))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
dm_list_init(removal_lvs);
|
|
||||||
|
|
||||||
/* Wait for events following any deactivation. */
|
/* Wait for events following any deactivation. */
|
||||||
sync_local_dev_names(vg->cmd);
|
if (!sync_local_dev_names(vg->cmd)) {
|
||||||
|
log_error("Failed to sync local devices after removing %u LVs in VG %s.",
|
||||||
|
dm_list_size(removal_lvs), vg->name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dm_list_init(removal_lvs);
|
||||||
|
|
||||||
if (vg_write_requested && !_vg_write_commit_backup(vg))
|
if (vg_write_requested && !_vg_write_commit_backup(vg))
|
||||||
return_0;
|
return_0;
|
||||||
|
Loading…
Reference in New Issue
Block a user