[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] blktap2: Fix another uninitialised value error


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Mon, 14 May 2012 16:32:22 +0000
  • Delivery-date: Mon, 14 May 2012 16:32:27 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1336656374 -3600
# Node ID 60064411a8a9b68136e16ae5abdd98410745d5c7
# Parent  81088df89e80b960ba922e4b82fcc504d86cb499
blktap2: Fix another uninitialised value error

gcc  -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing 
-std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement   
-D__XEN_TOOLS__ -MMD -MF .block-remus.o.d -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-fno-optimize-sibling-calls -mno-tls-direct-seg-refs -Werror -g -Wno-unused 
-fno-strict-aliasing -I../include -I../drivers 
-I/home/osstest/build.12828.build-i386/xen-unstable/tools/blktap2/drivers/../../../tools/libxc
 
-I/home/osstest/build.12828.build-i386/xen-unstable/tools/blktap2/drivers/../../../tools/include
 -D_GNU_SOURCE -DUSE_NFS_LOCKS  -c -o block-remus.o block-remus.c

block-remus.c: In function 'ramdisk_flush':
block-remus.c:508: error: 'buf' may be used uninitialized in this function
make[5]: *** [block-remus.o] Error 1

This is because gcc can see that merge_requests doesn't always set
*mergedbuf but gcc isn't able to prove that it always does so if
merge_requests returns 0 and that in that case the value of
ramdisk_flush::buf isn't used.

This is too useful a warning to disable, despite the occasional false
positive of this form.  The conventional approach is to suppress the
warning by explicitly initialising the variable to 0.

This has just come to light because 25275:27d63b9f111a reenabled
optimisation for this area of code, and gcc's data flow analysis
(which is required to trigger the uninitialised variable warning) only
occurs when optimisation is turned on.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 81088df89e80 -r 60064411a8a9 tools/blktap2/drivers/block-remus.c
--- a/tools/blktap2/drivers/block-remus.c       Thu May 10 12:19:16 2012 +0100
+++ b/tools/blktap2/drivers/block-remus.c       Thu May 10 14:26:14 2012 +0100
@@ -505,7 +505,7 @@ fail:
 static int ramdisk_flush(td_driver_t *driver, struct tdremus_state* s)
 {
        uint64_t* sectors;
-       char* buf;
+       char* buf = NULL;
        uint64_t base, batchlen;
        int i, j, count = 0;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.