All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@fedoraproject.org>
To: lvm-devel@redhat.com
Subject: master - dmsetup: add missing checks for dm_stats_create() ret value
Date: Mon,  9 Nov 2015 09:28:11 +0000 (UTC)	[thread overview]
Message-ID: <20151109092811.C18BC60CDC@fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=297d6773afbddd747bc1c56fd01182b9ca798f60
Commit:        297d6773afbddd747bc1c56fd01182b9ca798f60
Parent:        e90c5d206043af53e868c785707dabf070fa5747
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Mon Nov 9 09:45:53 2015 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Nov 9 10:19:19 2015 +0100

dmsetup: add missing checks for dm_stats_create() ret value

Coverity likes to see a check for dms not being NULL, so
add those missing ones...
---
 WHATS_NEW_DM    |    1 +
 tools/dmsetup.c |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 9e6a849..c735194 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
 Version 1.02.111 - 
 ====================================
+  Add checks for failing dm_stats_create() in dmsetup.
   Add missing fifo close when failed to initialize client connection.
 
 Version 1.02.110 - 30th October 2015
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index a5cbef5..d6c0ad7 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -4834,7 +4834,9 @@ static int _stats_create(CMD_ARGS)
 	if (_switches[AUX_DATA_ARG])
 		aux_data = _string_args[AUX_DATA_ARG];
 
-	dms = dm_stats_create(DM_STATS_PROGRAM_ID);
+	if (!(dms = dm_stats_create(DM_STATS_PROGRAM_ID)))
+		return_0;
+
 	if (!_bind_stats_device(dms, name))
 		goto_bad;
 
@@ -4906,7 +4908,8 @@ static int _stats_delete(CMD_ARGS)
 
 	region_id = (uint64_t) _int_args[REGION_ID_ARG];
 
-	dms = dm_stats_create(program_id);
+	if (!(dms = dm_stats_create(program_id)))
+		return_0;
 
 	if (!_bind_stats_device(dms, name))
 		goto_out;
@@ -4968,7 +4971,8 @@ static int _stats_print(CMD_ARGS)
 
 	region_id = (uint64_t) _int_args[REGION_ID_ARG];
 
-	dms = dm_stats_create(DM_STATS_PROGRAM_ID);
+	if (!(dms = dm_stats_create(DM_STATS_PROGRAM_ID)))
+		return_0;
 
 	if (!_bind_stats_device(dms, name))
 		goto_out;



                 reply	other threads:[~2015-11-09  9:28 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=20151109092811.C18BC60CDC@fedorahosted.org \
    --to=zkabelac@fedoraproject.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.