diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2015-08-04 10:16:45 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2015-08-04 10:35:31 +0200 |
commit | f02cdcff0084a323c9651d7ca2f22d60c83bcf3d (patch) | |
tree | f28e9f4d3b324bd2dd9ab1d5e2b93482b3fbee66 /lib/format1 | |
parent | 1f3d04cddf5a447de9bfb81ed22d0ccbe58e82fc (diff) | |
download | lvm2-f02cdcff0084a323c9651d7ca2f22d60c83bcf3d.tar.gz |
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.
Diffstat (limited to 'lib/format1')
-rw-r--r-- | lib/format1/import-export.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c index 275583d18..9e49a969c 100644 --- a/lib/format1/import-export.c +++ b/lib/format1/import-export.c @@ -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)) |