diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2021-09-20 10:24:30 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2021-09-20 14:26:09 +0200 |
commit | ebd150366f0852e7ebd32e7743e6a135138320a0 (patch) | |
tree | 30371d71ac127b6885e9d0149be4fa1559966fcd /libdm | |
parent | 752a9ec4b44198554b9f998ed6e4a837878fc49f (diff) | |
download | lvm2-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.c | 7 |
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; } |