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

[Xen-changelog] [xen staging] tools/ocaml: Fix build error with CentOS 7



commit 2cf41696950719fae260c05d47fb0c7548a990e1
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Sep 10 15:04:55 2019 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Sep 10 15:28:55 2019 +0100

    tools/ocaml: Fix build error with CentOS 7
    
    gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28) complains:
    
      xenctrl_stubs.c: In function 'stub_xc_domain_create':
      xenctrl_stubs.c:216:28: error: 'val' may be used uninitialized
                              in this function [-Werror=maybe-uninitialized]
         cfg.arch.emulation_flags = ocaml_list_to_c_bitmap
                                  ^
      xenctrl_stubs.c:198:12: error: 'val' may be used uninitialized
                              in this function [-Werror=maybe-uninitialized]
        cfg.flags = ocaml_list_to_c_bitmap
                  ^
      cc1: all warnings being treated as errors
    
    GCC doesn't point at the correct piece of code, but the diagnostic text is
    correct, and can occur when the list is empty. Initialise val to 0.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c 
b/tools/ocaml/libs/xc/xenctrl_stubs.c
index f86ecc7b7e..d7bc2cf40d 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -160,7 +160,7 @@ static unsigned int ocaml_list_to_c_bitmap(value l)
              * for xenctrl_abi_check.  The parsing there is ad-hoc.
              */
 {
-       unsigned int val;
+       unsigned int val = 0;
 
        for ( ; l != Val_none; l = Field(l, 1) )
                val |= 1u << Int_val(Field(l, 0));
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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