Gcc complains:

vhd-util-check.c: In function ‘vhd_util_check_footer’:
vhd-util-check.c:413:2: error: ‘buf’ may be used uninitialized in this function 
[-Werror=maybe-uninitialized]
  memcpy(&backup, buf, sizeof(backup));

In fact buf is initialised a few lines above.

Signed-off-by: Wei Liu <wei.l...@citrix.com>
---
I can't figure out why buf may be uninitialised and this seems to be the
only way to convince gcc it is ok to proceed.
---
 tools/blktap2/vhd/lib/vhd-util-check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/blktap2/vhd/lib/vhd-util-check.c 
b/tools/blktap2/vhd/lib/vhd-util-check.c
index af07426..40565ac 100644
--- a/tools/blktap2/vhd/lib/vhd-util-check.c
+++ b/tools/blktap2/vhd/lib/vhd-util-check.c
@@ -335,7 +335,7 @@ vhd_util_check_footer(int fd, vhd_footer_t *footer, int 
ignore)
 {
        size_t size;
        int err, opened;
-       char *msg, *buf;
+       char *msg, *buf = NULL;
        off_t eof, off;
        vhd_footer_t primary, backup;
 
-- 
2.1.4


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

Reply via email to