]> sourceware.org Git - lvm2.git/commitdiff
coverity: validate retval from get_only_segment_using_this_lv
authorZdenek Kabelac <zkabelac@redhat.com>
Mon, 26 Jun 2017 22:24:34 +0000 (00:24 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 26 Jun 2017 22:27:36 +0000 (00:27 +0200)
lib/activate/activate.c
lib/display/display.c

index 282dd4f151f7bd7abf1f127be423e8f805a91131..b3ed5131adf22fc98b44528cecbcdd0654a7cb75 100644 (file)
@@ -781,7 +781,8 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
        if (lv_is_used_cache_pool(lv)) {
                /* INFO is not set as cache-pool cannot be active.
                 * STATUS is collected from cache LV */
-               lv_seg = get_only_segment_using_this_lv(lv);
+               if (!(lv_seg = get_only_segment_using_this_lv(lv)))
+                       return_0;
                (void) _lv_info(cmd, lv_seg->lv, 1, NULL, lv_seg, &status->seg_status, 0, 0);
                return 1;
        }
index 18e49f977e857562e85faf07981eb56f23571d33..9a928d92d34269a2eca1f18c6812531bdf8af2ab 100644 (file)
@@ -517,8 +517,8 @@ int lvdisplay_full(struct cmd_context *cmd,
                log_print("LV Pool metadata       %s", seg->metadata_lv->name);
                log_print("LV Pool data           %s", seg_lv(seg, 0)->name);
        } else if (lv_is_cache_origin(lv)) {
-               log_print("LV origin of Cache LV  %s",
-                         get_only_segment_using_this_lv(lv)->lv->name);
+               if ((seg = get_only_segment_using_this_lv(lv)))
+                       log_print("LV origin of Cache LV  %s", seg->lv->name);
        } else if (lv_is_cache(lv)) {
                seg = first_seg(lv);
                if (inkernel && !lv_cache_status(lv, &cache_status))
This page took 0.045521 seconds and 5 git commands to generate.