All of lore.kernel.org
 help / color / mirror / Atom feed
* [blktap2] fix two 'maybe uninitialized' variables
@ 2014-06-11 12:01 Dario Faggioli
  2014-06-11 12:09 ` Dario Faggioli
  2014-06-12  9:18 ` Ian Campbell
  0 siblings, 2 replies; 11+ messages in thread
From: Dario Faggioli @ 2014-06-11 12:01 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell, Keir Fraser, Ian Jackson

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-07-02 15:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-11 12:01 [blktap2] fix two 'maybe uninitialized' variables Dario Faggioli
2014-06-11 12:09 ` 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

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.