]> sourceware.org Git - lvm2.git/commitdiff
gcc-fanalyzer: explicit test null not pass
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 17 Sep 2021 22:26:24 +0000 (00:26 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 20 Sep 2021 08:51:30 +0000 (10:51 +0200)
Make analyzer explicitelly aware we can't get NULL here.

lib/metadata/mirror.c
tools/vgcfgrestore.c

index 050341a03f0997f5ecf6c68c812ecd32e8337fe6..e2bf191a1ef068d76b6f6010dc1d8cc095ba5a52 100644 (file)
@@ -657,6 +657,11 @@ static int _split_mirror_images(struct logical_volume *lv,
                dm_list_add(&split_images, &lvl->list);
        }
 
+       if (!new_lv) {
+               log_error(INTERNAL_ERROR "New LV not found.");
+               return 0;
+       }
+
        new_lv->name = dm_pool_strdup(lv->vg->vgmem, split_name);
        if (!new_lv->name) {
                log_error("Unable to rename newly split LV.");
index e05c28688ac590323484f19e2eff422ef2bf8f62..e49313d144e809322f4af8284f0efcfc15d8916e 100644 (file)
@@ -104,7 +104,10 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
                return ECMD_PROCESSED;
        }
 
-       if (!_check_all_dm_devices(vg_name, &found)) {
+       if (!vg_name) {
+               log_error(INTERNAL_ERROR "VG name is not set.");
+               return ECMD_FAILED;
+       } else if (!_check_all_dm_devices(vg_name, &found)) {
                log_warn("WARNING: Failed to check for active volumes in volume group \"%s\".", vg_name);
        } else if (found) {
                log_warn("WARNING: Found %u active volume(s) in volume group \"%s\".",
This page took 0.036715 seconds and 5 git commands to generate.