mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
cov: check for NULL
Since we check for NULL pointers earlier we need to be consistent across function - since the NULL would applies across whole function. When dropping 'mda' check - we are actually already dereferencing it before - so it can't be NULL at that places (and it's validated before entering _read_mda_header_and_metadata).
This commit is contained in:
parent
43f149526d
commit
82e6b820b8
@ -341,7 +341,7 @@ static struct raw_locn *_read_metadata_location_vg(struct device_area *dev_area,
|
||||
* Don't try to check existing metadata
|
||||
* if given vgname is an empty string.
|
||||
*/
|
||||
if (!*vgname)
|
||||
if (!vgname || !*vgname)
|
||||
return rlocn;
|
||||
|
||||
/*
|
||||
|
@ -332,13 +332,11 @@ static int _read_mda_header_and_metadata(const struct format_type *fmt,
|
||||
log_warn("WARNING: bad metadata header on %s at %llu.",
|
||||
dev_name(mdac->area.dev),
|
||||
(unsigned long long)mdac->area.start);
|
||||
if (mda)
|
||||
mda->header_start = mdac->area.start;
|
||||
*bad_fields |= BAD_MDA_HEADER;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mda)
|
||||
mda->header_start = mdah->start;
|
||||
|
||||
mda_set_ignored(mda, rlocn_is_ignored(mdah->raw_locns));
|
||||
|
@ -420,7 +420,7 @@ check_duplicate:
|
||||
log_error("pvscan[%d] PV %s is duplicate for PVID %s on %d:%d and %d:%d.",
|
||||
getpid(), dev_name(dev), dev->pvid, major, minor, file_major, file_minor);
|
||||
|
||||
if (file_vgname[0] && strcmp(file_vgname, vgname))
|
||||
if (file_vgname[0] && vgname && strcmp(file_vgname, vgname))
|
||||
log_error("pvscan[%d] PV %s has unexpected VG %s vs %s.",
|
||||
getpid(), dev_name(dev), vgname, file_vgname);
|
||||
|
||||
|
@ -4284,7 +4284,8 @@ static int _process_pvs_in_vg(struct cmd_context *cmd,
|
||||
/*
|
||||
* When processing only specific PVs, we can quit once they've all been found.
|
||||
*/
|
||||
if (!process_all_pvs && dm_list_empty(arg_tags) && dm_list_empty(arg_devices))
|
||||
if (!process_all_pvs && dm_list_empty(arg_tags) &&
|
||||
(!arg_devices || dm_list_empty(arg_devices)))
|
||||
break;
|
||||
log_set_report_object_name_and_id(NULL, NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user