1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 20:25:52 +03:00

lvmetad: check for pointers not NULL

Check for  arg_vgid_lookup and arg_name_lookup not being NULL.
Drop checking arg_vgid and arg_name for NULL since they
are already dereference earlier - thus mostly must be NOT NULL.

(If that would be possible larger rework of this function would be
required).
This commit is contained in:
Zdenek Kabelac 2015-11-09 09:25:12 +01:00
parent f66fe2c444
commit 99def8f439

View File

@ -1378,7 +1378,7 @@ static int update_metadata(lvmetad_state *s, const char *arg_name, const char *a
* A lookup of the name arg was successful in finding arg_vgid_lookup,
* but that resulting vgid doesn't match the arg_vgid.
*/
if (arg_vgid_lookup && arg_vgid && strcmp(arg_vgid_lookup, arg_vgid)) {
if (arg_vgid_lookup && strcmp(arg_vgid_lookup, arg_vgid)) {
if (arg_name_lookup) {
/*
* This shouldn't happen.
@ -1419,7 +1419,7 @@ static int update_metadata(lvmetad_state *s, const char *arg_name, const char *a
* A lookup of the vgid arg was successful in finding arg_name_lookup,
* but that resulting name doesn't match the arg_name.
*/
if (arg_name_lookup && arg_name && strcmp(arg_name_lookup, arg_name)) {
if (arg_name_lookup && strcmp(arg_name_lookup, arg_name)) {
if (arg_vgid_lookup) {
/*
* This shouldn't happen.
@ -1459,7 +1459,7 @@ static int update_metadata(lvmetad_state *s, const char *arg_name, const char *a
* An existing VG has unchanged name and vgid.
*/
if (!new_vgid && !new_name) {
if (strcmp(arg_name_lookup, arg_name)) {
if (arg_name_lookup && strcmp(arg_name_lookup, arg_name)) {
/* This shouldn't happen. */
ERROR(s, "update_metadata arg_vgid %s arg_name %s mismatch arg_name_lookup %s",
arg_vgid, arg_name, arg_name_lookup);
@ -1467,7 +1467,7 @@ static int update_metadata(lvmetad_state *s, const char *arg_name, const char *a
goto update;
}
if (strcmp(arg_vgid_lookup, arg_vgid)) {
if (arg_vgid_lookup && strcmp(arg_vgid_lookup, arg_vgid)) {
/*
* This shouldn't usually happen, but could when
* disks are moved (or filters are changed?)