master - coverity: check vg->lvm1_system_id is not NULL before calling strncmp with that
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bcd193cb182188e7c45e705212c4cd6da10fd4f0 Commit: bcd193cb182188e7c45e705212c4cd6da10fd4f0 Parent: 1f3d04cddf5a447de9bfb81ed22d0ccbe58e82fc Author: Peter Rajnoha <[email protected]> AuthorDate: Tue Aug 4 10:16:45 2015 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Tue Aug 4 10:16:45 2015 +0200
coverity: check vg->lvm1_system_id is not NULL before calling strncmp with that
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 | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
lib/format1/import-export.c +1 -1
@@ -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 ))