mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
pvmove: check return value of top_level_lv_name()
The return value of top_level_lv_name() may be NULL, so we should check return value of top_level_lv_name before calling strcmp(lv->name, top_level_lv_name(vg, lv_name)). Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
This commit is contained in:
parent
c38c4d9d36
commit
d71199920f
@ -326,6 +326,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
|
|||||||
int lv_skipped = 0;
|
int lv_skipped = 0;
|
||||||
int needs_exclusive = *exclusive;
|
int needs_exclusive = *exclusive;
|
||||||
const struct logical_volume *holder;
|
const struct logical_volume *holder;
|
||||||
|
const char *new_lv_name;
|
||||||
|
|
||||||
/* FIXME Cope with non-contiguous => splitting existing segments */
|
/* FIXME Cope with non-contiguous => splitting existing segments */
|
||||||
if (!(lv_mirr = lv_create_empty("pvmove%d", NULL,
|
if (!(lv_mirr = lv_create_empty("pvmove%d", NULL,
|
||||||
@ -363,8 +364,13 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
|
|||||||
if (lv == lv_mirr)
|
if (lv == lv_mirr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (lv_name && strcmp(lv->name, top_level_lv_name(vg, lv_name)))
|
if (lv_name) {
|
||||||
|
if (!(new_lv_name = top_level_lv_name(vg, lv_name)))
|
||||||
|
return_NULL;
|
||||||
|
|
||||||
|
if (strcmp(lv->name, new_lv_name))
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!lv_is_on_pvs(lv, source_pvl))
|
if (!lv_is_on_pvs(lv, source_pvl))
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user