All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@fedoraproject.org>
To: lvm-devel@redhat.com
Subject: master - libdm: ensure vars are initialized
Date: Mon,  9 Nov 2015 09:28:26 +0000 (UTC)	[thread overview]
Message-ID: <20151109092826.C94F260CD3@fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f6c140e200177ef527c8943fbe0a94e2e6bd8b3f
Commit:        f6c140e200177ef527c8943fbe0a94e2e6bd8b3f
Parent:        b1c4017743060a25a6a263244d9d0e18c09acda5
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Sun Nov 8 17:21:22 2015 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Nov 9 10:19:19 2015 +0100

libdm: ensure vars are initialized

Coverity found potential error path, where code could
have used some unset variables.
---
 libdm/libdm-stats.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index d3ae1f2..43479d9 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -822,7 +822,7 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
 	struct dm_pool *mem = dms->mem;
 	struct dm_stats_counters cur;
 	FILE *stats_rows = NULL;
-	uint64_t start, len;
+	uint64_t start = 0, len = 0;
 	char row[256];
 	int r;
 
@@ -2305,6 +2305,10 @@ const char *dm_histogram_to_string(const struct dm_histogram *dmh, int bin,
 		} else if (bounds)
 			len = dm_snprintf(buf, sizeof(buf), "%s%s", bounds_buf,
 					  sep);
+		else {
+			*buf = '\0';
+			len = 0;
+		}
 
 		if (len < 0)
 			goto_bad;



                 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=20151109092826.C94F260CD3@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.