mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Add some log_error msg's and fix potential segfault
Thanks to kabi for spotting these - especially the possibility for segfault if a loop runs all the way through without finding a match.
This commit is contained in:
parent
4aebd52c4c
commit
b2fa9b43dc
@ -179,16 +179,20 @@ static int _shift_and_rename_image_components(struct lv_segment *seg)
|
|||||||
|
|
||||||
/* Alter rmeta name */
|
/* Alter rmeta name */
|
||||||
shift_name = dm_pool_strdup(cmd->mem, seg_metalv(seg, s)->name);
|
shift_name = dm_pool_strdup(cmd->mem, seg_metalv(seg, s)->name);
|
||||||
if (!shift_name)
|
if (!shift_name) {
|
||||||
return_0;
|
log_error("Memory allocation failed.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
len = strlen(shift_name) - 1;
|
len = strlen(shift_name) - 1;
|
||||||
shift_name[len] -= missing;
|
shift_name[len] -= missing;
|
||||||
seg_metalv(seg, s)->name = shift_name;
|
seg_metalv(seg, s)->name = shift_name;
|
||||||
|
|
||||||
/* Alter rimage name */
|
/* Alter rimage name */
|
||||||
shift_name = dm_pool_strdup(cmd->mem, seg_lv(seg, s)->name);
|
shift_name = dm_pool_strdup(cmd->mem, seg_lv(seg, s)->name);
|
||||||
if (!shift_name)
|
if (!shift_name) {
|
||||||
return_0;
|
log_error("Memory allocation failed.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
len = strlen(shift_name) - 1;
|
len = strlen(shift_name) - 1;
|
||||||
shift_name[len] -= missing;
|
shift_name[len] -= missing;
|
||||||
seg_lv(seg, s)->name = shift_name;
|
seg_lv(seg, s)->name = shift_name;
|
||||||
|
@ -2356,6 +2356,9 @@ int dm_tree_node_add_raid_target(struct dm_tree_node *node,
|
|||||||
dm_segtypes[i].type, size)))
|
dm_segtypes[i].type, size)))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
|
if (!seg)
|
||||||
|
return_0;
|
||||||
|
|
||||||
seg->region_size = region_size;
|
seg->region_size = region_size;
|
||||||
seg->stripe_size = stripe_size;
|
seg->stripe_size = stripe_size;
|
||||||
seg->area_count = 0;
|
seg->area_count = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user