All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>,
	Keir Fraser <keir@xen.org>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [blktap2] fix two 'maybe uninitialized' variables
Date: Wed, 11 Jun 2014 14:01:02 +0200	[thread overview]
Message-ID: <1402488062.16827.90.camel@Solace> (raw)

for which gcc 4.9.0 complains about, like this:

block-qcow.c: In function ‘get_cluster_offset’:
block-qcow.c:431:3: error: ‘tmp_ptr’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   memcpy(tmp_ptr, l1_ptr, 4096);
   ^
block-qcow.c:606:7: error: ‘tmp_ptr2’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   if (write(s->fd, tmp_ptr2, 4096) != 4096) {
       ^
cc1: all warnings being treated as errors
/home/dario/Sources/xen/xen/xen.git/tools/blktap2/drivers/../../../tools/Rules.mk:89: recipe for target 'block-qcow.o' failed
make[5]: *** [block-qcow.o] Error 1

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
diff --git a/tools/blktap2/drivers/block-qcow.c b/tools/blktap2/drivers/block-qcow.c
index d5053d4..c677bc9 100644
--- a/tools/blktap2/drivers/block-qcow.c
+++ b/tools/blktap2/drivers/block-qcow.c
@@ -383,8 +383,8 @@ static uint64_t get_cluster_offset(struct tdqcow_state *s,
                                    int n_start, int n_end)
 {
 	int min_index, i, j, l1_index, l2_index, l2_sector, l1_sector;
-	char *tmp_ptr2, *l2_ptr, *l1_ptr;
-	uint64_t *tmp_ptr;
+	char *tmp_ptr2 = NULL, *l2_ptr, *l1_ptr;
+	uint64_t *tmp_ptr = NULL;
 	uint64_t l2_offset, *l2_table, cluster_offset, tmp;
 	uint32_t min_count;
 	int new_l2_table;

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2014-06-11 12:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 12:01 Dario Faggioli [this message]
2014-06-11 12:09 ` [blktap2] fix two 'maybe uninitialized' variables Dario Faggioli
2014-06-12  9:18 ` Ian Campbell
2014-06-12  9:30   ` Dario Faggioli
2014-06-12 11:40     ` Dario Faggioli
2014-06-17 10:07       ` Dario Faggioli
2014-06-18 14:02       ` Ian Campbell
2014-06-20 14:11         ` Dario Faggioli
2014-06-23 17:08           ` Ian Jackson
2014-06-23 17:13           ` Ian Jackson
2014-07-02 15:07             ` Ian Jackson

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=1402488062.16827.90.camel@Solace \
    --to=dario.faggioli@citrix.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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.