1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

cov: check pointer before dereferencing

Check pv2 is non-null before trying to deref its tags.
This commit is contained in:
Zdenek Kabelac 2021-10-15 14:48:48 +02:00
parent 65ba4964df
commit 882141eb8c

View File

@ -2354,7 +2354,7 @@ static int _match_pv_tags(const struct dm_config_node *cling_tag_list_cn,
const struct dm_config_value *cv;
const char *str;
const char *tag_matched;
struct dm_list *tags_to_match = mem ? NULL : pv_tags ? : &pv2->tags;
struct dm_list *tags_to_match = mem ? NULL : pv_tags ? : ((pv2) ? &pv2->tags : NULL);
struct dm_str_list *sl;
unsigned first_tag = 1;
@ -2409,7 +2409,7 @@ static int _match_pv_tags(const struct dm_config_node *cling_tag_list_cn,
continue;
}
if (!str_list_match_list(&pv1->tags, tags_to_match, &tag_matched))
if (tags_to_match && !str_list_match_list(&pv1->tags, tags_to_match, &tag_matched))
continue;
if (!pv_tags) {