1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-18 18:50:44 +03:00

coverity: pointer validation

Check for metadata_lv and make sure we have got proper thin pool segment.

Check we are working with merging snapshot when adding merging target.
This commit is contained in:
Zdenek Kabelac 2013-07-19 17:28:43 +02:00
parent 90bdbcc201
commit aed4e9c703
2 changed files with 11 additions and 1 deletions

View File

@ -1998,7 +1998,12 @@ static int _add_snapshot_merge_target_to_dtree(struct dev_manager *dm,
struct logical_volume *lv)
{
const char *origin_dlid, *cow_dlid, *merge_dlid;
struct lv_segment *merging_snap_seg = find_merging_snapshot(lv);
struct lv_segment *merging_snap_seg;
if (!(merging_snap_seg = find_merging_snapshot(lv))) {
log_error(INTERNAL_ERROR "LV %s is not merging snapshot.", lv->name);
return 0;
}
if (!(origin_dlid = build_dm_uuid(dm->mem, lv->lvid.s, "real")))
return_0;

View File

@ -245,6 +245,11 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
if (!_thin_target_present(cmd, seg, &attr))
return_0;
if (!seg->metadata_lv) {
log_error(INTERNAL_ERROR "Thin pool is missing metadata device.");
return 0;
}
if (!(attr & THIN_FEATURE_BLOCK_SIZE) &&
(seg->chunk_size & (seg->chunk_size - 1))) {
log_error("Thin pool target does not support %uKiB chunk size "