1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Test lv_name is not NULL

Patch adds extra check for lv_name not being NULL.
Test avoids unneeded strlen call for this case.
Otherwise there is no functional change as test would fail on
size_t comparation even for NULL lv_name (thus there is no risk
of NULL dereference when taking 'true' if branch.
This commit is contained in:
Zdenek Kabelac 2010-12-01 12:22:49 +00:00
parent 062181292a
commit 5bd1cb414b

View File

@ -331,7 +331,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
tags_arg = NULL;
dm_list_init(&lvnames);
break;
} else if (!strncmp(vg_name, vgname, strlen(vgname)) &&
} else if (!strncmp(vg_name, vgname, strlen(vgname)) && lv_name &&
strlen(vgname) == (size_t) (lv_name - vg_name)) {
if (!str_list_add(cmd->mem, &lvnames,
dm_pool_strdup(cmd->mem,