From 63c052b9e2a69b94fea33490130e76aac9a8c735 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 23 Feb 2016 21:36:51 +0100 Subject: [PATCH] coverity: ensure thin_pool_seg is not NULL thin_pool_seg being NULL would be an internal error. --- lib/metadata/lv_manip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 64eb6b756..5e4a81ff4 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -1662,8 +1662,10 @@ static int _setup_alloced_segment(struct logical_volume *lv, uint64_t status, lv->size += (uint64_t) extents * lv->vg->extent_size; if (lv_is_thin_pool_data(lv)) { + if (!(thin_pool_seg = get_only_segment_using_this_lv(lv))) + return_0; + /* Update thin pool segment from the layered LV */ - thin_pool_seg = get_only_segment_using_this_lv(lv); thin_pool_seg->lv->le_count = thin_pool_seg->len = thin_pool_seg->area_len = lv->le_count;