From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - cov: validate subcommand existance
Date: Fri, 15 Oct 2021 21:42:21 +0000 (GMT) [thread overview]
Message-ID: <20211015214221.AEB9A3858401@sourceware.org> (raw)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6668d6409aa841839b8eefc2a49d004b0c29397a
Commit: 6668d6409aa841839b8eefc2a49d004b0c29397a
Parent: 2779830a060730801ae6b055c2332301bf913c0f
Author: Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate: Fri Oct 15 14:42:20 2021 +0200
Committer: Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Fri Oct 15 23:39:25 2021 +0200
cov: validate subcommand existance
Before dereference of subcommand pointer, check it's not NULL
as coverity believes there exists theoretical path for this...
---
libdm/dm-tools/dmsetup.c | 4 ++--
1 file 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);
reply other threads:[~2021-10-15 21:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211015214221.AEB9A3858401@sourceware.org \
--to=zkabelac@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.