summaryrefslogtreecommitdiff
path: root/libdm
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2021-10-15 14:42:20 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2021-10-15 23:39:25 +0200
commit6668d6409aa841839b8eefc2a49d004b0c29397a (patch)
treebb0c3ea239021ceb4d3c8924e9a91836ca680332 /libdm
parent2779830a060730801ae6b055c2332301bf913c0f (diff)
downloadlvm2-6668d6409aa841839b8eefc2a49d004b0c29397a.tar.gz
cov: validate subcommand existance
Before dereference of subcommand pointer, check it's not NULL as coverity believes there exists theoretical path for this...
Diffstat (limited to 'libdm')
-rw-r--r--libdm/dm-tools/dmsetup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
index 07b6cca8a..8502d9adc 100644
--- a/libdm/dm-tools/dmsetup.c
+++ b/libdm/dm-tools/dmsetup.c
@@ -5846,12 +5846,12 @@ static int _stats_report(CMD_ARGS)
if (_switches[ALL_PROGRAMS_ARG])
_program_id = "";
- if (_switches[VERBOSE_ARG] && !strcmp(subcommand, "list"))
+ if (_switches[VERBOSE_ARG] && subcommand && !strcmp(subcommand, "list"))
_statstype |= (DM_STATS_WALK_ALL
| DM_STATS_WALK_SKIP_SINGLE_AREA);
/* suppress duplicates unless the user has requested all regions */
- if (!strcmp(subcommand, "report") && !objtype_args)
+ if (subcommand && !objtype_args && !strcmp(subcommand, "report"))
/* suppress duplicate rows of output */
_statstype |= (DM_STATS_WALK_ALL
| DM_STATS_WALK_SKIP_SINGLE_AREA);