mirror of
git://sourceware.org/git/lvm2.git
synced 2024-10-05 12:19:48 +03:00
gcc: check cv pointer when needed
As 'cv' was already dereferenced, check for NULL with do {} while(); loop.
This commit is contained in:
parent
a98beb8ee3
commit
64ccbc4b52
@ -192,7 +192,7 @@ int read_flags(uint64_t *status, enum pv_vg_lv_e type, int mask, const struct dm
|
||||
if (cv->type == DM_CFG_EMPTY_ARRAY)
|
||||
goto out;
|
||||
|
||||
while (cv) {
|
||||
do {
|
||||
if (cv->type != DM_CFG_STRING) {
|
||||
log_error("Status value is not a string.");
|
||||
return 0;
|
||||
@ -228,8 +228,7 @@ int read_flags(uint64_t *status, enum pv_vg_lv_e type, int mask, const struct dm
|
||||
return 0;
|
||||
}
|
||||
|
||||
cv = cv->next;
|
||||
}
|
||||
} while ((cv = cv->next));
|
||||
|
||||
out:
|
||||
*status |= s;
|
||||
|
@ -159,7 +159,7 @@ static int _read_str_list(struct dm_pool *mem, struct dm_list *list, const struc
|
||||
if (cv->type == DM_CFG_EMPTY_ARRAY)
|
||||
return 1;
|
||||
|
||||
while (cv) {
|
||||
do {
|
||||
if (cv->type != DM_CFG_STRING) {
|
||||
log_error("Found an item that is not a string");
|
||||
return 0;
|
||||
@ -168,8 +168,7 @@ static int _read_str_list(struct dm_pool *mem, struct dm_list *list, const struc
|
||||
if (!str_list_add(mem, list, dm_pool_strdup(mem, cv->v.str)))
|
||||
return_0;
|
||||
|
||||
cv = cv->next;
|
||||
}
|
||||
} while ((cv = cv->next));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user