]> sourceware.org Git - lvm2.git/commitdiff
coverity: check vg->lvm1_system_id is not NULL before calling strncmp with that
authorPeter Rajnoha <prajnoha@redhat.com>
Tue, 4 Aug 2015 08:16:45 +0000 (10:16 +0200)
committerPeter Rajnoha <prajnoha@redhat.com>
Tue, 4 Aug 2015 08:35:31 +0000 (10:35 +0200)
lib/format1/import-export.c:167: var_deref_model: Passing null pointer "vg->lvm1_system_id" to "strncmp", which dereferences it.

lib/format1/import-export.c

index 275583d18339a2d17574372c3222c9579e973683..9e49a969ca949327ff3a22013a8de03867e76f89 100644 (file)
@@ -164,7 +164,7 @@ int export_pv(struct cmd_context *cmd, struct dm_pool *mem __attribute__((unused
        /* Is VG already exported or being exported? */
        if (vg && vg_is_exported(vg)) {
                /* Does system_id need setting? */
-               if ((vg->lvm1_system_id && !*vg->lvm1_system_id) ||
+               if (!vg->lvm1_system_id || !*vg->lvm1_system_id ||
                    strncmp(vg->lvm1_system_id, EXPORTED_TAG,
                            sizeof(EXPORTED_TAG) - 1)) {
                        if (!generate_lvm1_system_id(cmd, (char *)pvd->system_id, EXPORTED_TAG))
This page took 0.03896 seconds and 5 git commands to generate.