From: Zdenek Kabelac Date: Fri, 17 Sep 2021 22:26:24 +0000 (+0200) Subject: gcc-fanalyzer: explicit test null not pass X-Git-Tag: v2_03_14~131 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=5126ac7c3aa4f9f47a36c66095246d5b13871e61;p=lvm2.git gcc-fanalyzer: explicit test null not pass Make analyzer explicitelly aware we can't get NULL here. --- diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c index 050341a03..e2bf191a1 100644 --- a/lib/metadata/mirror.c +++ b/lib/metadata/mirror.c @@ -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."); diff --git a/tools/vgcfgrestore.c b/tools/vgcfgrestore.c index e05c28688..e49313d14 100644 --- a/tools/vgcfgrestore.c +++ b/tools/vgcfgrestore.c @@ -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\".",