summaryrefslogtreecommitdiff
path: root/libdm
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2021-09-20 10:24:30 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2021-09-20 14:26:09 +0200
commitebd150366f0852e7ebd32e7743e6a135138320a0 (patch)
tree30371d71ac127b6885e9d0149be4fa1559966fcd /libdm
parent752a9ec4b44198554b9f998ed6e4a837878fc49f (diff)
downloadlvm2-ebd150366f0852e7ebd32e7743e6a135138320a0.tar.gz
cov: add explicit NULL pointer check
Make obvious to coverity strcmp() is not getting NULL pointer.
Diffstat (limited to 'libdm')
-rw-r--r--libdm/dm-tools/dmsetup.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
index f431f7509..f6d1ecf90 100644
--- a/libdm/dm-tools/dmsetup.c
+++ b/libdm/dm-tools/dmsetup.c
@@ -6426,9 +6426,10 @@ static const struct command *_find_command(const struct command *commands,
{
int i;
- for (i = 0; commands[i].name; i++)
- if (!strcmp(commands[i].name, name))
- return commands + i;
+ if (name)
+ for (i = 0; commands[i].name; i++)
+ if (!strcmp(commands[i].name, name))
+ return commands + i;
return NULL;
}