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

lv_manip: add extra check for existin origin_lv

clang: it's supposedly impossible path to hit, as we should always
have origin_lv defined when running this path, but adding protection
isn't a big issue to make this obvious to analyzer.
This commit is contained in:
Zdenek Kabelac 2020-01-30 15:54:19 +01:00
parent 67f627c8fb
commit 336361b2f2

View File

@ -8372,7 +8372,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
* COW LV is activated via implicit activation of origin LV
* Only the snapshot origin holds the LV lock in cluster
*/
if (!vg_add_snapshot(origin_lv, lv, NULL,
if (!origin_lv ||
!vg_add_snapshot(origin_lv, lv, NULL,
origin_lv->le_count, lp->chunk_size)) {
log_error("Couldn't create snapshot.");
goto deactivate_and_revert_new_lv;