1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

lv_manip: add extra internal error

Catch error early, when trying to store data into non-allocated area.
This commit is contained in:
Zdenek Kabelac 2018-06-20 10:44:13 +02:00
parent 6c84a36b53
commit 106ee05ba0

View File

@ -1190,6 +1190,11 @@ int set_lv_segment_area_lv(struct lv_segment *seg, uint32_t area_num,
display_lvname(seg->lv), seg->le, area_num,
display_lvname(lv), le);
if (area_num >= seg->area_count) {
log_error(INTERNAL_ERROR "Try to set to high area number (%u >= %u) for LV %s.",
area_num, seg->area_count, display_lvname(seg->lv));
return 0;
}
lv->status |= status;
if (lv_is_raid_metadata(lv)) {
seg->meta_areas[area_num].type = AREA_LV;