mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +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
219b1d015b
commit
470f8b1266
@ -179,16 +179,20 @@ static int _shift_and_rename_image_components(struct lv_segment *seg)
|
||||
|
||||
/* Alter rmeta name */
|
||||
shift_name = dm_pool_strdup(cmd->mem, seg_metalv(seg, s)->name);
|
||||
if (!shift_name)
|
||||
return_0;
|
||||
if (!shift_name) {
|
||||
log_error("Memory allocation failed.");
|
||||
return 0;
|
||||
}
|
||||
len = strlen(shift_name) - 1;
|
||||
shift_name[len] -= missing;
|
||||
seg_metalv(seg, s)->name = shift_name;
|
||||
|
||||
/* Alter rimage name */
|
||||
shift_name = dm_pool_strdup(cmd->mem, seg_lv(seg, s)->name);
|
||||
if (!shift_name)
|
||||
return_0;
|
||||
if (!shift_name) {
|
||||
log_error("Memory allocation failed.");
|
||||
return 0;
|
||||
}
|
||||
len = strlen(shift_name) - 1;
|
||||
shift_name[len] -= missing;
|
||||
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)))
|
||||
return_0;
|
||||
|
||||
if (!seg)
|
||||
return_0;
|
||||
|
||||
seg->region_size = region_size;
|
||||
seg->stripe_size = stripe_size;
|
||||
seg->area_count = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user