mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
coverity: fix possible invalid dereferences
lib/format1/import-export.c:167: var_deref_op: Dereferencing null pointer "vg->lvm1_system_id" lib/cache/lvmetad.c:1023: var_deref_op: Dereferencing null pointer "this" daemons/lvmlockd/lvmlockd-core.c:2659: check_after_deref: Null-checking "act" suggests that it may be null, but it has already been dereferenced on all paths leading to the check /daemons/lvmetad/lvmetad-core.c:1024: check_after_deref: Null-checking "pvmeta" suggests that it may be null, but it has already been dereferenced on all paths leading to the check
This commit is contained in:
parent
cb305b9fc0
commit
023cf21848
@ -999,7 +999,8 @@ static response pv_gone(lvmetad_state *s, request r)
|
||||
|
||||
DEBUGLOG(s, "pv_gone (updated): %s / %" PRIu64, pvid, device);
|
||||
|
||||
pvmeta = dm_hash_lookup(s->pvid_to_pvmeta, pvid);
|
||||
if (!(pvmeta = dm_hash_lookup(s->pvid_to_pvmeta, pvid)))
|
||||
return reply_unknown("PVID does not exist");
|
||||
vgid = dm_hash_lookup(s->pvid_to_vgid, pvid);
|
||||
|
||||
dm_hash_remove_binary(s->device_to_pvid, &device, sizeof(device));
|
||||
@ -1021,9 +1022,6 @@ static response pv_gone(lvmetad_state *s, request r)
|
||||
dm_free(vgid);
|
||||
}
|
||||
|
||||
if (!pvmeta)
|
||||
return reply_unknown("PVID does not exist");
|
||||
|
||||
if (!alt_device)
|
||||
dm_config_destroy(pvmeta);
|
||||
|
||||
|
@ -2661,8 +2661,7 @@ static int rem_lockspace(struct action *act)
|
||||
}
|
||||
ls->thread_work = 1;
|
||||
ls->thread_stop = 1;
|
||||
if (act)
|
||||
list_add_tail(&act->list, &ls->actions);
|
||||
list_add_tail(&act->list, &ls->actions);
|
||||
pthread_cond_signal(&ls->cond);
|
||||
pthread_mutex_unlock(&ls->mutex);
|
||||
pthread_mutex_unlock(&lockspaces_mutex);
|
||||
|
3
lib/cache/lvmetad.c
vendored
3
lib/cache/lvmetad.c
vendored
@ -1017,7 +1017,8 @@ static int _lvmetad_pvscan_single(struct metadata_area *mda, void *baton)
|
||||
struct _lvmetad_pvscan_baton *b = baton;
|
||||
struct volume_group *this;
|
||||
|
||||
this = mda_is_ignored(mda) ? NULL : mda->ops->vg_read(b->fid, "", mda, NULL, NULL, 1);
|
||||
if (!(this = mda_is_ignored(mda) ? NULL : mda->ops->vg_read(b->fid, "", mda, NULL, NULL, 1)))
|
||||
return 1;
|
||||
|
||||
/* FIXME Also ensure contents match etc. */
|
||||
if (!b->vg || this->seqno > b->vg->seqno)
|
||||
|
@ -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 ||
|
||||
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))
|
||||
|
Loading…
Reference in New Issue
Block a user